Mercurial > hg > truffle
comparison graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.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 | aaac4894175c |
comparison
equal
deleted
inserted
replaced
4141:04d21be7a24f | 4142:bc8527f3071c |
---|---|
108 public static final String EMBEDDED_HCF_CLOSE = "HexCodeFile>>>"; | 108 public static final String EMBEDDED_HCF_CLOSE = "HexCodeFile>>>"; |
109 | 109 |
110 /** | 110 /** |
111 * Map from a machine code position to a list of comments for the position. | 111 * Map from a machine code position to a list of comments for the position. |
112 */ | 112 */ |
113 public final Map<Integer, List<String>> comments = new TreeMap<Integer, List<String>>(); | 113 public final Map<Integer, List<String>> comments = new TreeMap<>(); |
114 | 114 |
115 /** | 115 /** |
116 * Map from a machine code position to a comment for the operands of the instruction at the position. | 116 * Map from a machine code position to a comment for the operands of the instruction at the position. |
117 */ | 117 */ |
118 public final Map<Integer, String> operandComments = new TreeMap<Integer, String>(); | 118 public final Map<Integer, String> operandComments = new TreeMap<>(); |
119 | 119 |
120 public final byte[] code; | 120 public final byte[] code; |
121 | 121 |
122 public final ArrayList<JumpTable> jumpTables = new ArrayList<JumpTable>(); | 122 public final ArrayList<JumpTable> jumpTables = new ArrayList<>(); |
123 | 123 |
124 public final ArrayList<LookupTable> lookupTables = new ArrayList<LookupTable>(); | 124 public final ArrayList<LookupTable> lookupTables = new ArrayList<>(); |
125 | 125 |
126 public final String isa; | 126 public final String isa; |
127 | 127 |
128 public final int wordWidth; | 128 public final int wordWidth; |
129 | 129 |
203 * Adds a comment to the list of comments for a given position. | 203 * Adds a comment to the list of comments for a given position. |
204 */ | 204 */ |
205 public void addComment(int pos, String comment) { | 205 public void addComment(int pos, String comment) { |
206 List<String> list = comments.get(pos); | 206 List<String> list = comments.get(pos); |
207 if (list == null) { | 207 if (list == null) { |
208 list = new ArrayList<String>(); | 208 list = new ArrayList<>(); |
209 comments.put(pos, list); | 209 comments.put(pos, list); |
210 } | 210 } |
211 list.add(encodeString(comment)); | 211 list.add(encodeString(comment)); |
212 } | 212 } |
213 | 213 |
244 /** | 244 /** |
245 * Modifies a string to mangle any substrings matching {@link #SECTION_DELIM}. | 245 * Modifies a string to mangle any substrings matching {@link #SECTION_DELIM}. |
246 */ | 246 */ |
247 public static String encodeString(String s) { | 247 public static String encodeString(String s) { |
248 int index; | 248 int index; |
249 while ((index = s.indexOf(SECTION_DELIM)) != -1) { | 249 String result = s; |
250 s = s.substring(0, index) + " < |@" + s.substring(index + SECTION_DELIM.length()); | 250 while ((index = result.indexOf(SECTION_DELIM)) != -1) { |
251 } | 251 result = result.substring(0, index) + " < |@" + result.substring(index + SECTION_DELIM.length()); |
252 return s; | 252 } |
253 return result; | |
253 } | 254 } |
254 | 255 |
255 /** | 256 /** |
256 * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} | 257 * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} |
257 * and produce a {@link HexCodeFile} object. | 258 * and produce a {@link HexCodeFile} object. |