Mercurial > hg > truffle
comparison graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java @ 21543:93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 25 May 2015 23:30:34 +0200 |
parents | a847538be6e3 |
children | 48c1ebd24120 |
comparison
equal
deleted
inserted
replaced
21542:543957c1c6a6 | 21543:93c50cefb9e8 |
---|---|
31 import com.oracle.graal.api.meta.*; | 31 import com.oracle.graal.api.meta.*; |
32 import com.oracle.graal.asm.*; | 32 import com.oracle.graal.asm.*; |
33 import com.oracle.graal.asm.amd64.*; | 33 import com.oracle.graal.asm.amd64.*; |
34 import com.oracle.graal.asm.amd64.AMD64Address.Scale; | 34 import com.oracle.graal.asm.amd64.AMD64Address.Scale; |
35 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; | 35 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; |
36 import com.oracle.graal.compiler.common.*; | |
37 import com.oracle.graal.compiler.common.calc.*; | 36 import com.oracle.graal.compiler.common.calc.*; |
38 import com.oracle.graal.lir.*; | 37 import com.oracle.graal.lir.*; |
39 import com.oracle.graal.lir.StandardOp.BlockEndOp; | 38 import com.oracle.graal.lir.StandardOp.BlockEndOp; |
40 import com.oracle.graal.lir.SwitchStrategy.BaseSwitchClosure; | 39 import com.oracle.graal.lir.SwitchStrategy.BaseSwitchClosure; |
41 import com.oracle.graal.lir.asm.*; | 40 import com.oracle.graal.lir.asm.*; |
41 import com.oracle.jvmci.common.*; | |
42 | 42 |
43 public class AMD64ControlFlow { | 43 public class AMD64ControlFlow { |
44 | 44 |
45 public static final class ReturnOp extends AMD64LIRInstruction implements BlockEndOp { | 45 public static final class ReturnOp extends AMD64LIRInstruction implements BlockEndOp { |
46 public static final LIRInstructionClass<ReturnOp> TYPE = LIRInstructionClass.create(ReturnOp.class); | 46 public static final LIRInstructionClass<ReturnOp> TYPE = LIRInstructionClass.create(ReturnOp.class); |
170 assert condition == Condition.EQ || condition == Condition.NE; | 170 assert condition == Condition.EQ || condition == Condition.NE; |
171 AMD64Move.move(crb, masm, scratch, keyConstants[index]); | 171 AMD64Move.move(crb, masm, scratch, keyConstants[index]); |
172 masm.cmpptr(keyRegister, asObjectReg(scratch)); | 172 masm.cmpptr(keyRegister, asObjectReg(scratch)); |
173 break; | 173 break; |
174 default: | 174 default: |
175 throw new GraalInternalError("switch only supported for int, long and object"); | 175 throw new JVMCIError("switch only supported for int, long and object"); |
176 } | 176 } |
177 masm.jcc(intCond(condition), target); | 177 masm.jcc(intCond(condition), target); |
178 } | 178 } |
179 }; | 179 }; |
180 strategy.run(closure); | 180 strategy.run(closure); |
352 break; | 352 break; |
353 case Long: | 353 case Long: |
354 masm.cmovq(cond, asRegister(result), asRegister(other)); | 354 masm.cmovq(cond, asRegister(result), asRegister(other)); |
355 break; | 355 break; |
356 default: | 356 default: |
357 throw GraalInternalError.shouldNotReachHere(); | 357 throw JVMCIError.shouldNotReachHere(); |
358 } | 358 } |
359 } else { | 359 } else { |
360 AMD64Address addr = (AMD64Address) crb.asAddress(other); | 360 AMD64Address addr = (AMD64Address) crb.asAddress(other); |
361 switch (other.getKind()) { | 361 switch (other.getKind()) { |
362 case Boolean: | 362 case Boolean: |
368 break; | 368 break; |
369 case Long: | 369 case Long: |
370 masm.cmovq(cond, asRegister(result), addr); | 370 masm.cmovq(cond, asRegister(result), addr); |
371 break; | 371 break; |
372 default: | 372 default: |
373 throw GraalInternalError.shouldNotReachHere(); | 373 throw JVMCIError.shouldNotReachHere(); |
374 } | 374 } |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 private static ConditionFlag intCond(Condition cond) { | 378 private static ConditionFlag intCond(Condition cond) { |
396 case AT: | 396 case AT: |
397 return ConditionFlag.Above; | 397 return ConditionFlag.Above; |
398 case BT: | 398 case BT: |
399 return ConditionFlag.Below; | 399 return ConditionFlag.Below; |
400 default: | 400 default: |
401 throw GraalInternalError.shouldNotReachHere(); | 401 throw JVMCIError.shouldNotReachHere(); |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 private static ConditionFlag floatCond(Condition cond) { | 405 private static ConditionFlag floatCond(Condition cond) { |
406 switch (cond) { | 406 switch (cond) { |
415 case GE: | 415 case GE: |
416 return ConditionFlag.AboveEqual; | 416 return ConditionFlag.AboveEqual; |
417 case GT: | 417 case GT: |
418 return ConditionFlag.Above; | 418 return ConditionFlag.Above; |
419 default: | 419 default: |
420 throw GraalInternalError.shouldNotReachHere(); | 420 throw JVMCIError.shouldNotReachHere(); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 private static boolean trueOnUnordered(ConditionFlag condition) { | 424 private static boolean trueOnUnordered(ConditionFlag condition) { |
425 switch (condition) { | 425 switch (condition) { |
434 case Below: | 434 case Below: |
435 case GreaterEqual: | 435 case GreaterEqual: |
436 case NoOverflow: | 436 case NoOverflow: |
437 return true; | 437 return true; |
438 default: | 438 default: |
439 throw GraalInternalError.shouldNotReachHere(); | 439 throw JVMCIError.shouldNotReachHere(); |
440 } | 440 } |
441 } | 441 } |
442 } | 442 } |