Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java @ 2519:f6125fb5bfbc
Removed intrinsics.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 27 Apr 2011 16:25:32 +0200 |
parents | 4fdef1464592 |
children | 2f271a85d104 |
comparison
equal
deleted
inserted
replaced
2516:a384fac3fd34 | 2519:f6125fb5bfbc |
---|---|
447 Util.unimplemented(); | 447 Util.unimplemented(); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 @Override | 451 @Override |
452 protected void genCompareAndSwap(Intrinsic x, CiKind kind) { | |
453 assert x.numberOfArguments() == 5 : "wrong number of arguments: " + x.numberOfArguments(); | |
454 // Argument 0 is the receiver. | |
455 LIRItem obj = new LIRItem(x.argumentAt(1), this); // object | |
456 LIRItem offset = new LIRItem(x.argumentAt(2), this); // offset of field | |
457 LIRItem val = new LIRItem(x.argumentAt(4), this); // replace field with val if matches cmp | |
458 | |
459 assert obj.instruction.kind.isObject() : "invalid type"; | |
460 | |
461 assert val.instruction.kind == kind : "invalid type"; | |
462 | |
463 // get address of field | |
464 obj.loadItem(); | |
465 offset.loadNonconstant(); | |
466 CiAddress addr; | |
467 if (offset.result().isConstant()) { | |
468 addr = new CiAddress(kind, obj.result(), (int) ((CiConstant) offset.result()).asLong()); | |
469 } else { | |
470 addr = new CiAddress(kind, obj.result(), offset.result()); | |
471 } | |
472 | |
473 // Compare operand needs to be in RAX. | |
474 CiValue cmp = force(x.argumentAt(3), AMD64.rax.asValue(kind)); | |
475 val.loadItem(); | |
476 | |
477 CiValue pointer = newVariable(CiKind.Word); | |
478 lir.lea(addr, pointer); | |
479 | |
480 if (kind.isObject()) { // Write-barrier needed for Object fields. | |
481 // Do the pre-write barrier : if any. | |
482 preGCWriteBarrier(pointer, false, null); | |
483 } | |
484 | |
485 if (kind.isObject()) { | |
486 lir.casObj(pointer, cmp, val.result()); | |
487 } else if (kind.isInt()) { | |
488 lir.casInt(pointer, cmp, val.result()); | |
489 } else if (kind.isLong()) { | |
490 lir.casLong(pointer, cmp, val.result()); | |
491 } else { | |
492 Util.shouldNotReachHere(); | |
493 } | |
494 | |
495 // generate conditional move of boolean result | |
496 CiValue result = createResultVariable(x); | |
497 lir.cmove(Condition.EQ, CiConstant.INT_1, CiConstant.INT_0, result); | |
498 if (kind.isObject()) { // Write-barrier needed for Object fields. | |
499 // Seems to be precise | |
500 postGCWriteBarrier(pointer, val.result()); | |
501 } | |
502 } | |
503 | |
504 @Override | |
505 protected void genMathIntrinsic(Intrinsic x) { | |
506 assert x.numberOfArguments() == 1 : "wrong type"; | |
507 | |
508 CiValue calcInput = load(x.argumentAt(0)); | |
509 | |
510 switch (x.intrinsic()) { | |
511 case java_lang_Math$abs: | |
512 lir.abs(calcInput, createResultVariable(x), ILLEGAL); | |
513 break; | |
514 case java_lang_Math$sqrt: | |
515 lir.sqrt(calcInput, createResultVariable(x), ILLEGAL); | |
516 break; | |
517 case java_lang_Math$sin: | |
518 setResult(x, callRuntimeWithResult(CiRuntimeCall.ArithmeticSin, null, calcInput)); | |
519 break; | |
520 case java_lang_Math$cos: | |
521 setResult(x, callRuntimeWithResult(CiRuntimeCall.ArithmeticCos, null, calcInput)); | |
522 break; | |
523 case java_lang_Math$tan: | |
524 setResult(x, callRuntimeWithResult(CiRuntimeCall.ArithmeticTan, null, calcInput)); | |
525 break; | |
526 case java_lang_Math$log: | |
527 setResult(x, callRuntimeWithResult(CiRuntimeCall.ArithmeticLog, null, calcInput)); | |
528 break; | |
529 case java_lang_Math$log10: | |
530 setResult(x, callRuntimeWithResult(CiRuntimeCall.ArithmeticLog10, null, calcInput)); | |
531 break; | |
532 default: | |
533 Util.shouldNotReachHere("Unknown math intrinsic"); | |
534 } | |
535 } | |
536 | |
537 @Override | |
538 public void visitConvert(Convert x) { | 452 public void visitConvert(Convert x) { |
539 CiValue input = load(x.value()); | 453 CiValue input = load(x.value()); |
540 CiVariable result = newVariable(x.kind); | 454 CiVariable result = newVariable(x.kind); |
541 // arguments of lirConvert | 455 // arguments of lirConvert |
542 GlobalStub globalStub = null; | 456 GlobalStub globalStub = null; |