|
31 | 31 | import com.oracle.objectfile.debugentry.CompiledMethodEntry; |
32 | 32 | import com.oracle.objectfile.debugentry.FieldEntry; |
33 | 33 | import com.oracle.objectfile.debugentry.MethodEntry; |
| 34 | +import com.oracle.objectfile.debugentry.PrimitiveTypeEntry; |
34 | 35 | import com.oracle.objectfile.debugentry.Range; |
35 | 36 | import com.oracle.objectfile.debugentry.TypeEntry; |
36 | 37 | import org.graalvm.compiler.debug.GraalError; |
37 | 38 |
|
38 | 39 | import java.lang.reflect.Modifier; |
39 | 40 |
|
| 41 | +import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_INTEGRAL; |
| 42 | +import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_NUMERIC; |
40 | 43 | import static com.oracle.objectfile.pecoff.cv.CVConstants.CV_AMD64_CL; |
41 | 44 | import static com.oracle.objectfile.pecoff.cv.CVConstants.CV_AMD64_CX; |
42 | 45 | import static com.oracle.objectfile.pecoff.cv.CVConstants.CV_AMD64_DI; |
|
72 | 75 | import static com.oracle.objectfile.pecoff.cv.CVSymbolSubrecord.CVSymbolFrameProcRecord.FRAME_ASYNC_EH; |
73 | 76 | import static com.oracle.objectfile.pecoff.cv.CVSymbolSubrecord.CVSymbolFrameProcRecord.FRAME_LOCAL_BP; |
74 | 77 | import static com.oracle.objectfile.pecoff.cv.CVSymbolSubrecord.CVSymbolFrameProcRecord.FRAME_PARAM_BP; |
75 | | -import static com.oracle.objectfile.pecoff.cv.CVTypeConstants.T_REAL32; |
76 | | -import static com.oracle.objectfile.pecoff.cv.CVTypeConstants.T_REAL64; |
77 | 78 | import static com.oracle.objectfile.pecoff.cv.CVTypeConstants.MAX_PRIMITIVE; |
78 | 79 |
|
79 | 80 | final class CVSymbolSubsectionBuilder { |
@@ -216,21 +217,23 @@ void addLocals(CompiledMethodEntry primaryEntry) { |
216 | 217 | final TypeEntry paramType = method.getParamType(i); |
217 | 218 | final int typeIndex = cvDebugInfo.getCVTypeSection().addTypeRecords(paramType).getSequenceNumber(); |
218 | 219 | final String paramName = "p" + (i + 1); |
219 | | - if (typeIndex == T_REAL64 || typeIndex == T_REAL32) { |
220 | | - /* floating point primitive */ |
221 | | - if (fpRegisterIndex < javaFP64registers.length) { |
222 | | - final short register = typeIndex == T_REAL64 ? javaFP64registers[fpRegisterIndex] : javaFP32registers[fpRegisterIndex]; |
223 | | - addSymbolRecord(new CVSymbolSubrecord.CVSymbolLocalRecord(cvDebugInfo, paramName, typeIndex, 1)); |
224 | | - addSymbolRecord(new CVSymbolSubrecord.CVSymbolDefRangeRegisterRecord(cvDebugInfo, register, externalName, 0, 8)); |
225 | | - addSymbolRecord(new CVSymbolSubrecord.CVSymbolDefRangeFramepointerRelFullScope(cvDebugInfo, 0)); |
226 | | - fpRegisterIndex++; |
227 | | - } else { |
228 | | - /* TODO: handle stack parameter; keep track of stack offset, etc. */ |
229 | | - break; |
230 | | - } |
231 | | - } else if (paramType.isPrimitive()) { |
| 220 | + if (paramType.isPrimitive()) { |
232 | 221 | /* simple primitive */ |
233 | | - if (gpRegisterIndex < javaGP64registers.length) { |
| 222 | + final PrimitiveTypeEntry primitiveTypeEntry = (PrimitiveTypeEntry) paramType; |
| 223 | + final boolean isFloatingPoint = ((primitiveTypeEntry.getFlags() & FLAG_NUMERIC) != 0 && (primitiveTypeEntry.getFlags() & FLAG_INTEGRAL) == 0); |
| 224 | + if (isFloatingPoint) { |
| 225 | + /* floating point primitive */ |
| 226 | + if (fpRegisterIndex < javaFP64registers.length) { |
| 227 | + final short register = paramType.getSize() == Double.BYTES ? javaFP64registers[fpRegisterIndex] : javaFP32registers[fpRegisterIndex]; |
| 228 | + addSymbolRecord(new CVSymbolSubrecord.CVSymbolLocalRecord(cvDebugInfo, paramName, typeIndex, 1)); |
| 229 | + addSymbolRecord(new CVSymbolSubrecord.CVSymbolDefRangeRegisterRecord(cvDebugInfo, register, externalName, 0, 8)); |
| 230 | + addSymbolRecord(new CVSymbolSubrecord.CVSymbolDefRangeFramepointerRelFullScope(cvDebugInfo, 0)); |
| 231 | + fpRegisterIndex++; |
| 232 | + } else { |
| 233 | + /* TODO: handle stack parameter; keep track of stack offset, etc. */ |
| 234 | + break; |
| 235 | + } |
| 236 | + } else if (gpRegisterIndex < javaGP64registers.length) { |
234 | 237 | final short register; |
235 | 238 | if (paramType.getSize() == 8) { |
236 | 239 | register = javaGP64registers[gpRegisterIndex]; |
@@ -271,13 +274,13 @@ void addLocals(CompiledMethodEntry primaryEntry) { |
271 | 274 | } |
272 | 275 |
|
273 | 276 | private void addLineNumberRecords(CompiledMethodEntry compiledEntry) { |
274 | | - CVLineRecord record = lineRecordBuilder.build(compiledEntry); |
| 277 | + CVLineRecord lineRecord = lineRecordBuilder.build(compiledEntry); |
275 | 278 | /* |
276 | 279 | * If there are no file entries (perhaps for a synthetic function?), we don't add this |
277 | 280 | * record. |
278 | 281 | */ |
279 | | - if (!record.isEmpty()) { |
280 | | - cvDebugInfo.getCVSymbolSection().addRecord(record); |
| 282 | + if (!lineRecord.isEmpty()) { |
| 283 | + cvDebugInfo.getCVSymbolSection().addRecord(lineRecord); |
281 | 284 | } |
282 | 285 | } |
283 | 286 |
|
|
0 commit comments