Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ffb5ab

Browse filesBrowse files
author
hborders
committed
Removed INTRINSIC annotations and HOSTED_ONLY members.
1 parent c746770 commit 4ffb5ab
Copy full SHA for 4ffb5ab

1 file changed

-126Lines changed: 0 additions & 126 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎JavaInJava/src/com/sun/max/unsafe/Word.java‎

Copy file name to clipboardExpand all lines: JavaInJava/src/com/sun/max/unsafe/Word.java
-126Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import static com.sun.cri.bytecode.Bytecodes.*;
2424
import static com.sun.max.platform.Platform.*;
25-
import static com.sun.max.vm.MaxineVM.*;
2625

2726
import java.io.*;
2827
import java.lang.reflect.*;
@@ -60,81 +59,10 @@
6059
*/
6160
public abstract class Word {
6261

63-
/**
64-
* The array of all the subclasses of {@link Word} that are accessible on the classpath when
65-
* in hosted mode. This value of this array and {@link #unboxedToBoxedTypes} is constructed
66-
* by scanning the classpath for all classes named "Package" that subclasses {@link MaxPackage}.
67-
* An instance of each such class is instantiated and its {@link MaxPackage#wordSubclasses()} method
68-
* is invoked to obtain the set of classes in the denoted package that subclass {@code Word}.
69-
*/
70-
@HOSTED_ONLY
71-
private static Class[] classes;
72-
73-
/**
74-
* Constructed as a side effect of the first call to {@link #getSubclasses()}.
75-
*/
76-
@HOSTED_ONLY
77-
private static Map<Class, Class> unboxedToBoxedTypes;
78-
79-
/**
80-
* Gets all the classes on the current classpath that subclass {@link Word}.
81-
*/
82-
@HOSTED_ONLY
83-
public static Class[] getSubclasses() {
84-
if (classes == null) {
85-
final Map<Class, Class> map = new HashMap<Class, Class>();
86-
final Classpath cp = HostedBootClassLoader.HOSTED_BOOT_CLASS_LOADER.classpath();
87-
new ClassSearch() {
88-
@Override
89-
protected boolean visitClass(String className) {
90-
if (className.endsWith(".Package")) {
91-
try {
92-
Class<?> packageClass = Class.forName(className);
93-
if (MaxPackage.class.isAssignableFrom(packageClass)) {
94-
MaxPackage p = (MaxPackage) packageClass.newInstance();
95-
Class[] wordClasses = p.wordSubclasses();
96-
if (wordClasses != null) {
97-
for (Class wordClass : wordClasses) {
98-
String wordClassName = wordClass.getName();
99-
assert !Boxed.class.isAssignableFrom(wordClass) : "Boxed types should not be explicitly registered: " + wordClass.getName();
100-
assert Classes.getPackageName(wordClassName).equals(p.name()) :
101-
"Word subclass " + wordClass.getName() + " should be registered by " +
102-
Classes.getPackageName(wordClassName) + ".Package not " + p + ".Package";
103-
Class unboxedClass = wordClass;
104-
String boxedClassName = Classes.getPackageName(unboxedClass.getName()) + ".Boxed" + unboxedClass.getSimpleName();
105-
try {
106-
Class boxedClass = Class.forName(boxedClassName, false, Word.class.getClassLoader());
107-
map.put(unboxedClass, boxedClass);
108-
} catch (ClassNotFoundException e) {
109-
// There is no boxed version for this unboxed type
110-
map.put(unboxedClass, unboxedClass);
111-
}
112-
}
113-
}
114-
}
115-
} catch (Exception e) {
116-
ProgramWarning.message(e.toString());
117-
}
118-
}
119-
return true;
120-
}
121-
}.run(cp);
122-
123-
HashSet<Class> allClasses = new HashSet<Class>();
124-
allClasses.addAll(map.keySet());
125-
allClasses.addAll(map.values());
126-
classes = allClasses.toArray(new Class[allClasses.size()]);
127-
unboxedToBoxedTypes = map;
128-
}
129-
130-
return classes;
131-
}
132-
13362
protected Word() {
13463
}
13564

13665
@INLINE
137-
@INTRINSIC(WCONST_0)
13866
public static Word zero() {
13967
return Address.zero();
14068
}
@@ -164,7 +92,6 @@ public static int size() {
16492
return widthValue().numberOfBytes;
16593
}
16694

167-
@INTRINSIC(UNSAFE_CAST)
16895
public final JniHandle asJniHandle() {
16996
if (this instanceof BoxedJniHandle) {
17097
return (BoxedJniHandle) this;
@@ -173,7 +100,6 @@ public final JniHandle asJniHandle() {
173100
return BoxedJniHandle.from(box.value());
174101
}
175102

176-
@INTRINSIC(UNSAFE_CAST)
177103
public final Address asAddress() {
178104
if (this instanceof BoxedAddress) {
179105
return (BoxedAddress) this;
@@ -182,7 +108,6 @@ public final Address asAddress() {
182108
return BoxedAddress.from(box.value());
183109
}
184110

185-
@INTRINSIC(UNSAFE_CAST)
186111
public final Offset asOffset() {
187112
if (this instanceof BoxedOffset) {
188113
return (BoxedOffset) this;
@@ -191,7 +116,6 @@ public final Offset asOffset() {
191116
return BoxedOffset.from(box.value());
192117
}
193118

194-
@INTRINSIC(UNSAFE_CAST)
195119
public final Size asSize() {
196120
if (this instanceof BoxedSize) {
197121
return (BoxedSize) this;
@@ -200,7 +124,6 @@ public final Size asSize() {
200124
return BoxedSize.from(box.value());
201125
}
202126

203-
@INTRINSIC(UNSAFE_CAST)
204127
public final Pointer asPointer() {
205128
if (this instanceof BoxedPointer) {
206129
return (BoxedPointer) this;
@@ -212,53 +135,17 @@ public final Pointer asPointer() {
212135
/**
213136
* @return bit index of the least significant bit set, or -1 if zero.
214137
*/
215-
@INTRINSIC(LSB)
216138
public final int leastSignificantBitSet() {
217139
return SpecialBuiltin.leastSignificantBit(this);
218140
}
219141

220142
/**
221143
* @return bit index of the least significant bit set, or -1 if zero.
222144
*/
223-
@INTRINSIC(MSB)
224145
public final int mostSignificantBitSet() {
225146
return SpecialBuiltin.mostSignificantBit(this);
226147
}
227148

228-
@HOSTED_ONLY
229-
public static <Word_Type extends Word> Class<? extends Word_Type> getBoxedType(Class<Word_Type> wordType) {
230-
if (Boxed.class.isAssignableFrom(wordType)) {
231-
return wordType;
232-
}
233-
final Class<Class<? extends Word_Type>> type = null;
234-
return Utils.cast(type, unboxedToBoxedTypes.get(wordType));
235-
}
236-
237-
@HOSTED_ONLY
238-
public final <Word_Type extends Word> Word_Type as(Class<Word_Type> wordType) {
239-
if (wordType.isInstance(this)) {
240-
return wordType.cast(this);
241-
}
242-
if (Pointer.class.isAssignableFrom(wordType)) {
243-
return wordType.cast(asPointer());
244-
}
245-
if (Size.class.isAssignableFrom(wordType)) {
246-
return wordType.cast(asSize());
247-
}
248-
if (Address.class.isAssignableFrom(wordType)) {
249-
return wordType.cast(asAddress());
250-
}
251-
if (Offset.class.isAssignableFrom(wordType)) {
252-
return wordType.cast(asOffset());
253-
}
254-
try {
255-
final Constructor constructor = getBoxedType(wordType).getConstructor(Boxed.class);
256-
return wordType.cast(constructor.newInstance((Boxed) this));
257-
} catch (Throwable throwable) {
258-
throw ProgramError.unexpected(throwable);
259-
}
260-
}
261-
262149
public final String toHexString() {
263150
String result = Long.toHexString(asAddress().toLong());
264151
if (width() == 32 && result.length() > 8) {
@@ -286,29 +173,16 @@ public final int hashCode() {
286173

287174
@INLINE
288175
public final boolean isZero() {
289-
if (isHosted()) {
290-
final Boxed box = (Boxed) this;
291-
return box.value() == 0;
292-
}
293176
return equals(Word.zero());
294177
}
295178

296179
@INLINE
297180
public final boolean isAllOnes() {
298-
if (isHosted()) {
299-
final Boxed box = (Boxed) this;
300-
return box.value() == -1;
301-
}
302181
return equals(Word.allOnes());
303182
}
304183

305184
@INLINE
306185
public final boolean equals(Word other) {
307-
if (isHosted()) {
308-
final Boxed thisBox = (Boxed) this;
309-
final Boxed otherBox = (Boxed) other;
310-
return thisBox.value() == otherBox.value();
311-
}
312186
if (Word.width() == 64) {
313187
return asOffset().toLong() == other.asOffset().toLong();
314188
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.