Mercurial > hg > graal-jvmci-8
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 2055:99ad52189524
Refactorings to get towards less CRI overhead.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Thu, 13 Jan 2011 17:45:17 +0100 |
parents | 00bc9eaf0e24 |
children | 89bf01e6b049 |
comparison
equal
deleted
inserted
replaced
2054:3c0a889a176b | 2055:99ad52189524 |
---|---|
35 import com.sun.cri.xir.*; | 35 import com.sun.cri.xir.*; |
36 import com.sun.cri.xir.CiXirAssembler.XirLabel; | 36 import com.sun.cri.xir.CiXirAssembler.XirLabel; |
37 import com.sun.cri.xir.CiXirAssembler.XirMark; | 37 import com.sun.cri.xir.CiXirAssembler.XirMark; |
38 import com.sun.cri.xir.CiXirAssembler.XirOperand; | 38 import com.sun.cri.xir.CiXirAssembler.XirOperand; |
39 import com.sun.cri.xir.CiXirAssembler.XirParameter; | 39 import com.sun.cri.xir.CiXirAssembler.XirParameter; |
40 import com.sun.cri.xir.CiXirAssembler.XirTemp; | |
40 | 41 |
41 /** | 42 /** |
42 * | 43 * |
43 * @author Thomas Wuerthinger, Lukas Stadler | 44 * @author Thomas Wuerthinger, Lukas Stadler |
44 */ | 45 */ |
373 asm.nop(1); | 374 asm.nop(1); |
374 asm.mark(MARK_IMPLICIT_NULL); | 375 asm.mark(MARK_IMPLICIT_NULL); |
375 } | 376 } |
376 asm.pload(kind, result, object, fieldOffset, is(NULL_CHECK, flags)); | 377 asm.pload(kind, result, object, fieldOffset, is(NULL_CHECK, flags)); |
377 return asm.finishTemplate("getfield<" + kind + ">"); | 378 return asm.finishTemplate("getfield<" + kind + ">"); |
379 } | |
380 }; | |
381 | |
382 private KindTemplates writeBarrierTemplate = new KindTemplates() { | |
383 | |
384 @Override | |
385 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { | |
386 asm.restart(CiKind.Void); | |
387 XirParameter object = asm.createInputParameter("object", CiKind.Object); | |
388 | |
389 // Need temp operand, because the write barrier destroys the object pointer. | |
390 XirOperand temp = asm.createTemp("temp", CiKind.Object); | |
391 asm.mov(temp, object); | |
392 | |
393 writeBarrier(asm, temp); | |
394 return asm.finishTemplate("writeBarrier"); | |
378 } | 395 } |
379 }; | 396 }; |
380 | 397 |
381 private KindTemplates putFieldTemplates = new KindTemplates(WRITE_BARRIER, NULL_CHECK, UNRESOLVED) { | 398 private KindTemplates putFieldTemplates = new KindTemplates(WRITE_BARRIER, NULL_CHECK, UNRESOLVED) { |
382 | 399 |
883 } | 900 } |
884 return new XirSnippet(getFieldTemplates.get(site, field.kind(), UNRESOLVED), object); | 901 return new XirSnippet(getFieldTemplates.get(site, field.kind(), UNRESOLVED), object); |
885 } | 902 } |
886 | 903 |
887 @Override | 904 @Override |
905 public XirSnippet genWriteBarrier(XirArgument object) { | |
906 return new XirSnippet(writeBarrierTemplate.get(null, CiKind.Void), object); | |
907 } | |
908 | |
909 @Override | |
888 public XirSnippet genPutField(XirSite site, XirArgument object, RiField field, XirArgument value) { | 910 public XirSnippet genPutField(XirSite site, XirArgument object, RiField field, XirArgument value) { |
889 if (field.isResolved()) { | 911 if (field.isResolved()) { |
890 return new XirSnippet(putFieldTemplates.get(site, field.kind()), object, value, XirArgument.forInt(((HotSpotField) field).offset())); | 912 return new XirSnippet(putFieldTemplates.get(site, field.kind()), object, value, XirArgument.forInt(((HotSpotField) field).offset())); |
891 } | 913 } |
892 return new XirSnippet(putFieldTemplates.get(site, field.kind(), UNRESOLVED), object, value); | 914 return new XirSnippet(putFieldTemplates.get(site, field.kind(), UNRESOLVED), object, value); |