annotate graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java @ 17328:c9bb0da795d4

Backed out of changeset 17322:655f3e6b467b
author Doug Simon <doug.simon@oracle.com>
date Fri, 03 Oct 2014 14:19:58 +0200
parents 655f3e6b467b
children 86ec7f6f71b3
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 java.lang.reflect.*;
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 org.junit.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
28
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.api.code.*;
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.api.meta.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
31 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
32 import com.oracle.graal.nodes.*;
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.calc.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
34 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
35 import com.oracle.graal.phases.*;
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
36 import com.oracle.graal.phases.common.*;
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
37 import com.oracle.graal.phases.tiers.*;
8944
e7766460ddb3 Move tests into *.test packages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8635
diff changeset
38 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
39 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
40 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
41 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
42 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
43
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
44 /**
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
45 * 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
46 */
8413
d9347ee39fbe rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
47 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
48
9792
06dc2d2324d6 pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents: 9526
diff changeset
49 private static final LocationIdentity ID = new NamedLocationIdentity("ID");
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
50 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
51 private final TargetDescription target;
8628
77de2f3df379 renames: [HotSpot]ReplacementsInstaller -> [HotSpot]ReplacementsImpl
Doug Simon <doug.simon@oracle.com>
parents: 8416
diff changeset
52 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
53
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
54 public PointerTest() {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
55 target = getCodeCache().getTarget();
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14991
diff changeset
56 installer = new ReplacementsImpl(getProviders(), getSnippetReflection(), new Assumptions(false), getTarget());
7903
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
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
59 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
60
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
61 @Override
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
62 protected StructuredGraph parseEager(Method m) {
11959
23ccaa863eda made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11870
diff changeset
63 ResolvedJavaMethod resolvedMethod = getMetaAccess().lookupJavaMethod(m);
16383
657ff04a7b73 look for original method and substitution when processing snippet graph
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16156
diff changeset
64 return installer.makeGraph(resolvedMethod, 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
65 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
66
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
67 @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
68 public void testRead1() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
69 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
70 assertRead(parseEager("read" + kind.name() + "1"), kind, true, ID);
7903
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 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
73
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
74 @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
75 public void testRead2() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
76 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
77 assertRead(parseEager("read" + kind.name() + "2"), kind, true, ID);
7903
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 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
80
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
81 @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
82 public void testRead3() {
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
83 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
84 assertRead(parseEager("read" + kind.name() + "3"), 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
85 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
86 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
87
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
88 @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
89 public void testWrite1() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
90 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
91 assertWrite(parseEager("write" + kind.name() + "1"), kind, true, ID);
7903
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 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
94
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
95 @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
96 public void testWrite2() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
97 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
98 assertWrite(parseEager("write" + kind.name() + "2"), kind, true, ID);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
99 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
100 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
101
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
102 @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
103 public void testWrite3() {
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
104 for (Kind kind : KINDS) {
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
105 assertWrite(parseEager("write" + kind.name() + "3"), 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
106 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
107 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
108
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
109 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
110 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
111
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
112 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
113 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
114
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
115 Assert.assertEquals(cast, read.object());
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
116 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
117 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
118
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
119 IndexedLocationNode location = (IndexedLocationNode) read.location();
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
120 Assert.assertEquals(kind, location.getValueKind());
9525
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
121 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
122 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
123
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
124 if (indexConvert) {
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
125 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
126 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
127 Assert.assertEquals(convert.getResultBits(), 64);
16156
0993768dfc8e new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15263
diff changeset
128 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
129 } else {
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
130 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
131 }
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 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
134 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
135 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
136
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
137 private void assertWrite(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
138 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
139
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
140 JavaWriteNode write = (JavaWriteNode) cast.next();
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
141 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
142 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
143
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
144 Assert.assertEquals(cast, write.object());
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
145 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
146 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
147
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
148 IndexedLocationNode location = (IndexedLocationNode) write.location();
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
149 Assert.assertEquals(kind, location.getValueKind());
9525
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
150 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
151 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
152
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
153 if (indexConvert) {
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
154 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
155 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
156 Assert.assertEquals(convert.getResultBits(), 64);
16156
0993768dfc8e new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15263
diff changeset
157 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
158 } else {
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
159 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
160 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
161
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
162 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
163 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
164 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
167 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
168 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
169 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
172 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
173 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
174 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
175
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
176 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
177 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
178 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
179 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
180
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
181 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
182 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
183 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
184 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
187 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
188 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
189 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
190
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
191 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
192 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
193 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
194 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
195
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
196 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
197 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
198 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
199 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
202 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
203 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
204 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
205
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
206 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
207 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
208 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
209 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
210
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
211 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
212 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
213 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
214 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
217 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
218 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
219 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
220
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
221 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
222 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
223 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
224 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
225
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
226 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
227 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
228 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
229 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
232 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
233 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
234 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
235
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
236 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
237 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
238 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
239 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
240
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
241 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
242 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
243 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
244 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
247 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
248 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
249 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
250
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
251 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
252 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
253 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
254 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
255
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
256 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
257 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
258 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
259 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
262 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
263 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
264 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
265
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
266 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
267 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
268 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
269 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
270
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
271 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
272 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
273 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
274 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
277 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
278 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
279 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
280
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
281 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
282 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
283 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
284 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
285
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
286 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
287 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
288 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
289 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
292 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
293 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
294 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
295
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
296 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
297 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
298 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
299 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
300
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
301 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
302 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
303 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
304 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
307 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
308 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
309 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
310
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
311 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
312 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
313 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
314 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
315
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
316 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
317 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
318 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
319 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
322 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
323 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
324 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
325
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
326 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
327 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
328 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
329 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
330
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
331 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
332 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
333 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
334 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
337 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
338 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
339 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
340
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
341 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
342 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
343 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
344 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
345
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
346 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
347 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
348 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
349 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
352 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
353 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
354 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
355
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
356 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
357 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
358 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
359 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
360
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
361 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
362 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
363 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
364 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
367 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
368 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
369 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
370
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
371 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
372 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
373 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
374 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
375
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
376 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
377 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
378 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
379 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
382 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
383 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
384 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
385
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
386 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
387 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
388 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
389 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
390
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
391 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
392 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
393 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
394 }
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 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
397 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
398 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
399 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
400
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
401 @Snippet
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
402 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
403 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
404 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
405
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
406 private void assertNumWordCasts(String snippetName, int expectedWordCasts) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
407 Assumptions assumptions = new Assumptions(true);
12054
bba234a1670e grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
408 HighTierContext context = new HighTierContext(getProviders(), assumptions, null, null, OptimisticOptimizations.ALL);
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
409
16714
1668de777c42 renamed GraalCompilerTest.parse to GraalCompilerTest.parseEager and improved javadoc for all parse* methods
Doug Simon <doug.simon@oracle.com>
parents: 16383
diff changeset
410 StructuredGraph graph = parseEager(snippetName);
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
411 new CanonicalizerPhase(false).apply(graph, context);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
412 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
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 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
416 public void testUnusedFromObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
417 assertNumWordCasts("unusedFromObject", 0);
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 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
421 public static void unusedFromObject(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
422 Word.fromObject(o);
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 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
426 public void testUnusedRawValue() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
427 assertNumWordCasts("unusedRawValue", 0);
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 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
431 public static void unusedRawValue(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
432 Word.fromObject(o).rawValue();
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 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
436 public void testUsedRawValue() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
437 assertNumWordCasts("usedRawValue", 1);
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 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
441 public static long usedRawValue(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
442 return Word.fromObject(o).rawValue();
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 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
446 public void testUnusedToObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
447 assertNumWordCasts("unusedToObject", 0);
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 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
451 public static void unusedToObject(Word w) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
452 w.toObject();
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 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
456 public void testUsedToObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
457 assertNumWordCasts("usedToObject", 1);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
458 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
459
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
460 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
461 public static Object usedToObject(Word w) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
462 return w.toObject();
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
463 }
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
464 }