comparison graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java @ 22604:b00cc0475f31

Update jvmci import: Refactoring: Rename Kind to JavaKind.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 08 Sep 2015 19:57:39 +0200
parents dcfd57b9f2d3
children ed489bbcccbb
comparison
equal deleted inserted replaced
22603:6d339ba0edc5 22604:b00cc0475f31
138 } 138 }
139 139
140 if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) { 140 if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
141 HotSpotRegistersProvider registers = getProviders().getRegisters(); 141 HotSpotRegistersProvider registers = getProviders().getRegisters();
142 Register thread = registers.getThreadRegister(); 142 Register thread = registers.getThreadRegister();
143 Value threadTemp = newVariable(LIRKind.value(Kind.Long)); 143 Value threadTemp = newVariable(LIRKind.value(JavaKind.Long));
144 Register stackPointer = registers.getStackPointerRegister(); 144 Register stackPointer = registers.getStackPointerRegister();
145 Variable spScratch = newVariable(LIRKind.value(target().wordKind)); 145 Variable spScratch = newVariable(LIRKind.value(target().wordKind));
146 append(new SPARCHotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread, stackPointer, threadTemp, spScratch)); 146 append(new SPARCHotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread, stackPointer, threadTemp, spScratch));
147 result = super.emitForeignCall(hotspotLinkage, debugInfo, args); 147 result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
148 append(new SPARCHotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadJavaFrameAnchorFlagsOffset(), thread, threadTemp)); 148 append(new SPARCHotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadJavaFrameAnchorFlagsOffset(), thread, threadTemp));
238 } 238 }
239 239
240 public Variable emitCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) { 240 public Variable emitCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) {
241 LIRKind kind = newValue.getLIRKind(); 241 LIRKind kind = newValue.getLIRKind();
242 assert kind.equals(expectedValue.getLIRKind()); 242 assert kind.equals(expectedValue.getLIRKind());
243 Kind memKind = (Kind) kind.getPlatformKind(); 243 JavaKind memKind = (JavaKind) kind.getPlatformKind();
244 Variable result = newVariable(newValue.getLIRKind()); 244 Variable result = newVariable(newValue.getLIRKind());
245 append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue))); 245 append(new CompareAndSwapOp(result, asAllocatable(address), asAllocatable(expectedValue), asAllocatable(newValue)));
246 return emitConditionalMove(memKind, expectedValue, result, Condition.EQ, true, trueValue, falseValue); 246 return emitConditionalMove(memKind, expectedValue, result, Condition.EQ, true, trueValue, falseValue);
247 } 247 }
248 248
285 Value localA = a; 285 Value localA = a;
286 Value localB = b; 286 Value localB = b;
287 if (isConstantValue(a)) { 287 if (isConstantValue(a)) {
288 Constant c = asConstant(a); 288 Constant c = asConstant(a);
289 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) { 289 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
290 localA = SPARC.g0.asValue(LIRKind.value(Kind.Int)); 290 localA = SPARC.g0.asValue(LIRKind.value(JavaKind.Int));
291 } else if (c instanceof HotSpotObjectConstant) { 291 } else if (c instanceof HotSpotObjectConstant) {
292 localA = load(localA); 292 localA = load(localA);
293 } 293 }
294 } 294 }
295 if (isConstantValue(b)) { 295 if (isConstantValue(b)) {
296 Constant c = asConstant(b); 296 Constant c = asConstant(b);
297 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) { 297 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
298 localB = SPARC.g0.asValue(LIRKind.value(Kind.Int)); 298 localB = SPARC.g0.asValue(LIRKind.value(JavaKind.Int));
299 } else if (c instanceof HotSpotObjectConstant) { 299 } else if (c instanceof HotSpotObjectConstant) {
300 localB = load(localB); 300 localB = load(localB);
301 } 301 }
302 } 302 }
303 return super.emitCompare(cmpKind, localA, localB); 303 return super.emitCompare(cmpKind, localA, localB);
304 } 304 }
305 305
306 @Override 306 @Override
307 public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) { 307 public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
308 LIRKind inputKind = pointer.getLIRKind(); 308 LIRKind inputKind = pointer.getLIRKind();
309 assert inputKind.getPlatformKind() == Kind.Long || inputKind.getPlatformKind() == Kind.Object; 309 assert inputKind.getPlatformKind() == JavaKind.Long || inputKind.getPlatformKind() == JavaKind.Object;
310 if (inputKind.isReference(0)) { 310 if (inputKind.isReference(0)) {
311 // oop 311 // oop
312 Variable result = newVariable(LIRKind.reference(Kind.Int)); 312 Variable result = newVariable(LIRKind.reference(JavaKind.Int));
313 append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); 313 append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
314 return result; 314 return result;
315 } else { 315 } else {
316 // metaspace pointer 316 // metaspace pointer
317 Variable result = newVariable(LIRKind.value(Kind.Int)); 317 Variable result = newVariable(LIRKind.value(JavaKind.Int));
318 AllocatableValue base = Value.ILLEGAL; 318 AllocatableValue base = Value.ILLEGAL;
319 if (encoding.base != 0) { 319 if (encoding.base != 0) {
320 base = emitLoadConstant(LIRKind.value(Kind.Long), JavaConstant.forLong(encoding.base)); 320 base = emitLoadConstant(LIRKind.value(JavaKind.Long), JavaConstant.forLong(encoding.base));
321 } 321 }
322 append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); 322 append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
323 return result; 323 return result;
324 } 324 }
325 } 325 }
326 326
327 @Override 327 @Override
328 public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) { 328 public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
329 LIRKind inputKind = pointer.getLIRKind(); 329 LIRKind inputKind = pointer.getLIRKind();
330 assert inputKind.getPlatformKind() == Kind.Int; 330 assert inputKind.getPlatformKind() == JavaKind.Int;
331 if (inputKind.isReference(0)) { 331 if (inputKind.isReference(0)) {
332 // oop 332 // oop
333 Variable result = newVariable(LIRKind.reference(Kind.Object)); 333 Variable result = newVariable(LIRKind.reference(JavaKind.Object));
334 append(new SPARCHotSpotMove.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); 334 append(new SPARCHotSpotMove.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
335 return result; 335 return result;
336 } else { 336 } else {
337 // metaspace pointer 337 // metaspace pointer
338 Variable result = newVariable(LIRKind.value(Kind.Long)); 338 Variable result = newVariable(LIRKind.value(JavaKind.Long));
339 AllocatableValue base = Value.ILLEGAL; 339 AllocatableValue base = Value.ILLEGAL;
340 if (encoding.base != 0) { 340 if (encoding.base != 0) {
341 base = emitLoadConstant(LIRKind.value(Kind.Long), JavaConstant.forLong(encoding.base)); 341 base = emitLoadConstant(LIRKind.value(JavaKind.Long), JavaConstant.forLong(encoding.base));
342 } 342 }
343 append(new SPARCHotSpotMove.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); 343 append(new SPARCHotSpotMove.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
344 return result; 344 return result;
345 } 345 }
346 } 346 }
374 }; 374 };
375 // @formatter:on 375 // @formatter:on
376 StackSlotValue[] savedRegisterLocations = new StackSlotValue[savedRegisters.length]; 376 StackSlotValue[] savedRegisterLocations = new StackSlotValue[savedRegisters.length];
377 for (int i = 0; i < savedRegisters.length; i++) { 377 for (int i = 0; i < savedRegisters.length; i++) {
378 PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory()); 378 PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory());
379 assert kind != Kind.Illegal; 379 assert kind != JavaKind.Illegal;
380 VirtualStackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind)); 380 VirtualStackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind));
381 savedRegisterLocations[i] = spillSlot; 381 savedRegisterLocations[i] = spillSlot;
382 } 382 }
383 return emitSaveRegisters(savedRegisters, savedRegisterLocations, false); 383 return emitSaveRegisters(savedRegisters, savedRegisterLocations, false);
384 } 384 }
453 } 453 }
454 454
455 @Override 455 @Override
456 public void emitNullCheck(Value address, LIRFrameState state) { 456 public void emitNullCheck(Value address, LIRFrameState state) {
457 PlatformKind kind = address.getPlatformKind(); 457 PlatformKind kind = address.getPlatformKind();
458 if (kind == Kind.Int) { 458 if (kind == JavaKind.Int) {
459 CompressEncoding encoding = config.getOopEncoding(); 459 CompressEncoding encoding = config.getOopEncoding();
460 Value uncompressed = emitUncompress(address, encoding, false); 460 Value uncompressed = emitUncompress(address, encoding, false);
461 append(new NullCheckOp(asAddressValue(uncompressed), state)); 461 append(new NullCheckOp(asAddressValue(uncompressed), state));
462 } else { 462 } else {
463 super.emitNullCheck(address, state); 463 super.emitNullCheck(address, state);