comparison graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscTemplateCreator.java @ 4142:bc8527f3071c

Adjust code base to new level of warnings.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 18 Dec 2011 05:24:06 +0100
parents e233f5660da4
children
comparison
equal deleted inserted replaced
4141:04d21be7a24f 4142:bc8527f3071c
33 public class RiscTemplateCreator { 33 public class RiscTemplateCreator {
34 34
35 public RiscTemplateCreator() { 35 public RiscTemplateCreator() {
36 } 36 }
37 37
38 private List<RiscTemplate> templates = new LinkedList<RiscTemplate>(); 38 private List<RiscTemplate> templates = new LinkedList<>();
39 39
40 public List<RiscTemplate> templates() { 40 public List<RiscTemplate> templates() {
41 return templates; 41 return templates;
42 } 42 }
43 43
44 protected RiscTemplate createTemplate(InstructionDescription instructionDescription) { 44 protected RiscTemplate createTemplate(InstructionDescription instructionDescription) {
45 return new RiscTemplate(instructionDescription); 45 return new RiscTemplate(instructionDescription);
46 } 46 }
47 47
48 public List<RiscTemplate> createOptionTemplates(List<RiscTemplate> templateList, OptionField optionField) { 48 public List<RiscTemplate> createOptionTemplates(List<RiscTemplate> templateList, OptionField optionField) {
49 final List<RiscTemplate> newTemplates = new LinkedList<RiscTemplate>(); 49 final List<RiscTemplate> newTemplates = new LinkedList<>();
50 for (RiscTemplate template : templateList) { 50 for (RiscTemplate template : templateList) {
51 RiscTemplate canonicalRepresentative = null; 51 RiscTemplate canonicalRepresentative = null;
52 if (optionField.defaultOption() != null) { 52 if (optionField.defaultOption() != null) {
53 canonicalRepresentative = (RiscTemplate) template.clone(); 53 canonicalRepresentative = (RiscTemplate) template.clone();
54 canonicalRepresentative.organizeOption(optionField.defaultOption(), null); 54 canonicalRepresentative.organizeOption(optionField.defaultOption(), null);
65 } 65 }
66 return newTemplates; 66 return newTemplates;
67 } 67 }
68 68
69 private int serial; 69 private int serial;
70 @SuppressWarnings("serial")
70 private HashMap<String, List<RiscTemplate>> nameToTemplates = new HashMap<String, List<RiscTemplate>>() { 71 private HashMap<String, List<RiscTemplate>> nameToTemplates = new HashMap<String, List<RiscTemplate>>() {
71 @Override 72 @Override
72 public List<RiscTemplate> get(Object key) { 73 public List<RiscTemplate> get(Object key) {
73 List<RiscTemplate> list = super.get(key); 74 List<RiscTemplate> list = super.get(key);
74 if (list == null) { 75 if (list == null) {
75 list = new ArrayList<RiscTemplate>(); 76 list = new ArrayList<>();
76 put((String) key, list); 77 put((String) key, list);
77 } 78 }
78 return list; 79 return list;
79 } 80 }
80 }; 81 };
82 public List<RiscTemplate> nameToTemplates(String name) { 83 public List<RiscTemplate> nameToTemplates(String name) {
83 return nameToTemplates.get(name); 84 return nameToTemplates.get(name);
84 } 85 }
85 86
86 public void createTemplates(RiscInstructionDescriptionCreator instructionDescriptionCreator) { 87 public void createTemplates(RiscInstructionDescriptionCreator instructionDescriptionCreator) {
87 final List<RiscTemplate> initialTemplates = new LinkedList<RiscTemplate>(); 88 final List<RiscTemplate> initialTemplates = new LinkedList<>();
88 for (InstructionDescription instructionDescription : instructionDescriptionCreator.instructionDescriptions()) { 89 for (InstructionDescription instructionDescription : instructionDescriptionCreator.instructionDescriptions()) {
89 final RiscTemplate template = createTemplate(instructionDescription); 90 final RiscTemplate template = createTemplate(instructionDescription);
90 initialTemplates.add(template); 91 initialTemplates.add(template);
91 RiscInstructionDescriptionVisitor.Static.visitInstructionDescription(template, instructionDescription); 92 RiscInstructionDescriptionVisitor.Static.visitInstructionDescription(template, instructionDescription);
92 } 93 }
93 for (RiscTemplate initialTemplate : initialTemplates) { 94 for (RiscTemplate initialTemplate : initialTemplates) {
94 List<RiscTemplate> newTemplates = new LinkedList<RiscTemplate>(); 95 List<RiscTemplate> newTemplates = new LinkedList<>();
95 newTemplates.add(initialTemplate); 96 newTemplates.add(initialTemplate);
96 for (OptionField optionField : initialTemplate.optionFields()) { 97 for (OptionField optionField : initialTemplate.optionFields()) {
97 newTemplates = createOptionTemplates(newTemplates, optionField); 98 newTemplates = createOptionTemplates(newTemplates, optionField);
98 } 99 }
99 for (RiscTemplate template : newTemplates) { 100 for (RiscTemplate template : newTemplates) {