comparison graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotXirGenerator.java @ 4452:b225da954a32

inlining of multiple trival methods at one call site works
author Christian Haeubl <christian.haeubl@oracle.com>
date Fri, 27 Jan 2012 18:16:32 -0800
parents 21400bafb3ff
children 11a4af4a6621
comparison
equal deleted inserted replaced
4451:defa1b705f14 4452:b225da954a32
1105 1105
1106 private SimpleTemplates typeCheckTemplates = new SimpleTemplates(NULL_CHECK) { 1106 private SimpleTemplates typeCheckTemplates = new SimpleTemplates(NULL_CHECK) {
1107 @Override 1107 @Override
1108 protected XirTemplate create(CiXirAssembler asm, long flags) { 1108 protected XirTemplate create(CiXirAssembler asm, long flags) {
1109 asm.restart(); 1109 asm.restart();
1110 XirParameter object = asm.createInputParameter("object", CiKind.Object); 1110 XirParameter objHub = asm.createInputParameter("objectHub", CiKind.Object);
1111 XirOperand hub = asm.createConstantInputParameter("hub", CiKind.Object); 1111 XirOperand hub = asm.createConstantInputParameter("hub", CiKind.Object);
1112 1112 XirLabel falseSucc = asm.createInlineLabel(XirLabel.FalseSuccessor);
1113 XirOperand objHub = asm.createTemp("objHub", CiKind.Object); 1113
1114 XirOperand checkHub = asm.createTemp("checkHub", CiKind.Object); 1114 XirOperand checkHub = asm.createTemp("checkHub", CiKind.Object);
1115
1116 XirLabel slowPath = asm.createOutOfLineLabel("deopt");
1117 1115
1118 if (is(NULL_CHECK, flags)) { 1116 if (is(NULL_CHECK, flags)) {
1119 asm.mark(MARK_IMPLICIT_NULL); 1117 asm.mark(MARK_IMPLICIT_NULL);
1120 } 1118 }
1121 1119
1122 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false);
1123 asm.mov(checkHub, hub); 1120 asm.mov(checkHub, hub);
1124 // if we get an exact match: continue 1121 // if we get an exact match: continue
1125 asm.jneq(slowPath, objHub, checkHub); 1122 asm.jneq(falseSucc, objHub, checkHub);
1126 1123
1127 // -- out of line ------------------------------------------------------- 1124 return asm.finishTemplate(objHub, "typeCheck");
1128 asm.bindOutOfLine(slowPath);
1129 XirOperand scratch = asm.createRegisterTemp("scratch", target.wordKind, AMD64.r10);
1130 asm.mov(scratch, wordConst(asm, 2));
1131
1132 asm.callRuntime(CiRuntimeCall.Deoptimize, null);
1133 asm.shouldNotReachHere();
1134
1135 return asm.finishTemplate(object, "typeCheck");
1136 } 1125 }
1137 }; 1126 };
1138 1127
1139 @Override 1128 @Override
1140 public XirSnippet genPrologue(XirSite site, RiResolvedMethod method) { 1129 public XirSnippet genPrologue(XirSite site, RiResolvedMethod method) {
1298 public XirSnippet genArrayLength(XirSite site, XirArgument array) { 1287 public XirSnippet genArrayLength(XirSite site, XirArgument array) {
1299 return new XirSnippet(arrayLengthTemplates.get(site), array); 1288 return new XirSnippet(arrayLengthTemplates.get(site), array);
1300 } 1289 }
1301 1290
1302 @Override 1291 @Override
1303 public XirSnippet genTypeCheck(XirSite site, XirArgument object, XirArgument hub, RiType type) { 1292 public XirSnippet genTypeBranch(XirSite site, XirArgument thisHub, XirArgument otherHub, RiType type) {
1304 assert type instanceof RiResolvedType; 1293 assert type instanceof RiResolvedType;
1305 return new XirSnippet(typeCheckTemplates.get(site), object, hub); 1294 return new XirSnippet(typeCheckTemplates.get(site), thisHub, otherHub);
1306 } 1295 }
1307 1296
1308 @Override 1297 @Override
1309 public void initialize(CiXirAssembler asm) { 1298 public void initialize(CiXirAssembler asm) {
1310 this.globalAsm = asm; 1299 this.globalAsm = asm;