Mercurial > hg > graal-jvmci-8
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 1417:2c41834aa270
Small adaptations
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Wed, 23 Jun 2010 17:20:40 +0200 |
parents | 1b41af477605 |
children | 7bf6a77b9c5a |
comparison
equal
deleted
inserted
replaced
1416:1b41af477605 | 1417:2c41834aa270 |
---|---|
37 import com.sun.cri.xir.CiXirAssembler.XirOperand; | 37 import com.sun.cri.xir.CiXirAssembler.XirOperand; |
38 | 38 |
39 /** | 39 /** |
40 * | 40 * |
41 * @author Thomas Wuerthinger | 41 * @author Thomas Wuerthinger |
42 * | 42 * |
43 */ | 43 */ |
44 public class HotSpotXirGenerator extends RiXirGenerator { | 44 public class HotSpotXirGenerator extends RiXirGenerator { |
45 | 45 |
46 private XirTemplate[] emptyTemplates = new XirTemplate[CiKind.values().length]; | 46 private XirTemplate[] emptyTemplates = new XirTemplate[CiKind.values().length]; |
47 | 47 |
48 @Override | 48 @Override |
49 public List<XirTemplate> buildTemplates(CiXirAssembler asm) { | 49 public List<XirTemplate> buildTemplates(CiXirAssembler asm) { |
50 | 50 |
51 List<XirTemplate> templates = new ArrayList<XirTemplate>(); | 51 List<XirTemplate> templates = new ArrayList<XirTemplate>(); |
52 for (int i=0; i<CiKind.values().length; i++) { | 52 for (int i = 0; i < CiKind.values().length; i++) { |
53 | 53 |
54 CiKind curKind = CiKind.values()[i]; | 54 CiKind curKind = CiKind.values()[i]; |
55 | 55 |
56 if (curKind == CiKind.Float || curKind == CiKind.Double) continue; | 56 if (curKind == CiKind.Float || curKind == CiKind.Double) |
57 | 57 continue; |
58 | |
58 if (CiKind.values()[i] == CiKind.Void) { | 59 if (CiKind.values()[i] == CiKind.Void) { |
59 asm.restart(CiKind.values()[i]); | 60 asm.restart(CiKind.values()[i]); |
60 emptyTemplates[i] = asm.finishTemplate("empty-" + CiKind.values()[i]); | 61 emptyTemplates[i] = asm.finishTemplate("empty-" |
62 + CiKind.values()[i]); | |
61 } else { | 63 } else { |
62 asm.restart(); | 64 asm.restart(); |
63 XirOperand result = asm.createTemp("result", CiKind.values()[i]); | 65 XirOperand result = asm |
64 emptyTemplates[i] = asm.finishTemplate(result, "empty-" + CiKind.values()[i]); | 66 .createTemp("result", CiKind.values()[i]); |
67 emptyTemplates[i] = asm.finishTemplate(result, "empty-" | |
68 + CiKind.values()[i]); | |
65 } | 69 } |
66 templates.add(emptyTemplates[i]); | 70 templates.add(emptyTemplates[i]); |
67 } | 71 } |
68 | 72 |
69 | |
70 return templates; | 73 return templates; |
71 } | 74 } |
72 | 75 |
73 @Override | 76 @Override |
74 public XirSnippet genArrayLength(XirSite site, XirArgument array) { | 77 public XirSnippet genArrayLength(XirSite site, XirArgument array) { |
75 return new XirSnippet(emptyTemplates[CiKind.Int.ordinal()]); | 78 return new XirSnippet(emptyTemplates[CiKind.Int.ordinal()]); |
76 } | 79 } |
77 | 80 |