summaryrefslogtreecommitdiff
path: root/src/ToolBox/superpmi/superpmi
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolBox/superpmi/superpmi')
-rw-r--r--src/ToolBox/superpmi/superpmi/icorjitinfo.cpp9
-rw-r--r--src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp22
-rw-r--r--src/ToolBox/superpmi/superpmi/neardiffer.cpp2
-rw-r--r--src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp6
-rw-r--r--src/ToolBox/superpmi/superpmi/superpmi.cpp2
-rw-r--r--src/ToolBox/superpmi/superpmi/superpmi.h3
6 files changed, 23 insertions, 21 deletions
diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
index 41b0195a6d..b746d3f6f7 100644
--- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
@@ -1018,7 +1018,7 @@ bool MyICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
// in the code are. The native compiler will ensure that these places
// have a corresponding break point in native code.
//
-// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
+// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
// be used only as a hint and the native compiler should not change its
// code generation.
void MyICJI::getBoundaries(
@@ -1068,7 +1068,7 @@ void MyICJI::setBoundaries(
// under debugging, the JIT needs to keep them live over their
// entire scope so that they can be inspected.
//
-// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
+// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
// be used only as a hint and the native compiler should not change its
// code generation.
void MyICJI::getVars(
@@ -1192,9 +1192,8 @@ CorInfoType MyICJI::getHFAType (
)
{
jitInstance->mc->cr->AddCall("getHFAType");
- LogError("Hit unimplemented getHFAType");
- DebugBreakorAV(75);
- return (CorInfoType)0;
+ CorInfoType value = jitInstance->mc->repGetHFAType(hClass);
+ return value;
}
/*****************************************************************************
diff --git a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
index 0a43f02dd9..5cebc97db4 100644
--- a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
+++ b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
@@ -50,11 +50,11 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
if (mc->dumpMethodMD5HashToBuffer(md5Hash, MD5_HASH_BUFFER_SIZE) != MD5_HASH_BUFFER_SIZE)
md5Hash[0] = 0;
- charCount += sprintf(rowData + charCount, "%s,", md5Hash);
+ charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%s,", md5Hash);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'n') != NULL || strchr(statsTypes, 'N') != NULL)
{
- charCount += sprintf(rowData + charCount, "%d,", methodNumber);
+ charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", methodNumber);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL)
{
@@ -63,7 +63,7 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
- charCount += sprintf(rowData + charCount, "%d,", info.ILCodeSize);
+ charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", info.ILCodeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL)
{
@@ -76,11 +76,11 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
else
codeSize = 0;//this is likely a thin mc
- charCount += sprintf(rowData + charCount, "%d,", codeSize);
+ charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", codeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
{
- charCount += sprintf(rowData + charCount, "%llu,%llu,", firstTime, secondTime);
+ charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime);
}
//get rid of the final ',' and replace it with a '\n'
@@ -105,15 +105,15 @@ void MethodStatsEmitter::SetStatsTypes(char *types)
DWORD bytesWritten = 0;
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL)
- charCount += sprintf(rowHeader + charCount, "HASH,");
+ charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "HASH,");
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'n') != NULL || strchr(statsTypes, 'N') != NULL)
- charCount += sprintf(rowHeader + charCount, "METHOD_NUMBER,");
+ charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "METHOD_NUMBER,");
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL)
- charCount += sprintf(rowHeader + charCount, "IL_CODE_SIZE,");
+ charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "IL_CODE_SIZE,");
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL)
- charCount += sprintf(rowHeader + charCount, "ASM_CODE_SIZE,");
+ charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "ASM_CODE_SIZE,");
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
- charCount += sprintf(rowHeader + charCount, "Time1,Time2,");
+ charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "Time1,Time2,");
//get rid of the final ',' and replace it with a '\n'
rowHeader[charCount - 1] = '\n';
@@ -123,4 +123,4 @@ void MethodStatsEmitter::SetStatsTypes(char *types)
LogError("Failed to write row header '%s'. GetLastError()=%u", rowHeader, GetLastError());
}
}
-} \ No newline at end of file
+}
diff --git a/src/ToolBox/superpmi/superpmi/neardiffer.cpp b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
index 5b2e3b1b57..3f2c4db3b8 100644
--- a/src/ToolBox/superpmi/superpmi/neardiffer.cpp
+++ b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
@@ -154,7 +154,7 @@ void NearDiffer::DumpCodeBlock(unsigned char *block, ULONG blocksize, void *orig
const size_t minInstrBytes = 7;
size_t instrBytes = max(instrSize, minInstrBytes);
- size_t buffSize = _snprintf(nullptr, 0, "%p %s\n", (void*)((size_t)originalAddr+offset), instrMnemonic) + 3 * instrBytes + 1;
+ size_t buffSize = sizeof("%p %s\n") + 10 + count + 3 * instrBytes + 1;
char *buff = new char[buffSize];
int written = 0;
written += sprintf_s(buff, buffSize, "%p ", (void*)((size_t)originalAddr+offset));
diff --git a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
index 8c5232315e..301db3cfe9 100644
--- a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
+++ b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
@@ -138,7 +138,7 @@ bool WriteArrayToMCL(char *mclFilename, int *arr, int count)
DWORD charCount = 0;
DWORD bytesWritten = 0;
- charCount = sprintf(strMethodIndex, "%d\r\n", arr[i]);
+ charCount = sprintf_s(strMethodIndex, sizeof(strMethodIndex), "%d\r\n", arr[i]);
if (!WriteFile(hMCLFile, strMethodIndex, charCount, &bytesWritten, nullptr) || (bytesWritten != charCount))
{
@@ -232,7 +232,7 @@ void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int
if (o.applyDiff)
{
int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0;
- int converted = sscanf(buff, g_AsmDiffsSummaryFormatString, &temp1, &temp2, &temp3, &temp4);
+ int converted = sscanf_s(buff, g_AsmDiffsSummaryFormatString, &temp1, &temp2, &temp3, &temp4);
if (converted != 4)
{
LogError("Couldn't parse status message: \"%s\"", buff);
@@ -248,7 +248,7 @@ void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int
else
{
int temp1 = 0, temp2 = 0, temp3 = 0;
- int converted = sscanf(buff, g_SummaryFormatString, &temp1, &temp2, &temp3);
+ int converted = sscanf_s(buff, g_SummaryFormatString, &temp1, &temp2, &temp3);
if (converted != 3)
{
LogError("Couldn't parse status message: \"%s\"", buff);
diff --git a/src/ToolBox/superpmi/superpmi/superpmi.cpp b/src/ToolBox/superpmi/superpmi/superpmi.cpp
index ce352070f8..980792d4a9 100644
--- a/src/ToolBox/superpmi/superpmi/superpmi.cpp
+++ b/src/ToolBox/superpmi/superpmi/superpmi.cpp
@@ -45,6 +45,8 @@ void SetSuperPmiTargetArchitecture(const char* targetArchitecture)
}
#elif defined(_TARGET_X86_)
SpmiTargetArchitecture = SPMI_TARGET_ARCHITECTURE_X86;
+#elif defined(_TARGET_ARM_)
+ SpmiTargetArchitecture = SPMI_TARGET_ARCHITECTURE_ARM;
#endif
}
diff --git a/src/ToolBox/superpmi/superpmi/superpmi.h b/src/ToolBox/superpmi/superpmi/superpmi.h
index d5b7bdaa2b..ce535994a0 100644
--- a/src/ToolBox/superpmi/superpmi/superpmi.h
+++ b/src/ToolBox/superpmi/superpmi/superpmi.h
@@ -12,7 +12,8 @@ enum SPMI_TARGET_ARCHITECTURE
{
SPMI_TARGET_ARCHITECTURE_X86,
SPMI_TARGET_ARCHITECTURE_AMD64,
- SPMI_TARGET_ARCHITECTURE_ARM64
+ SPMI_TARGET_ARCHITECTURE_ARM64,
+ SPMI_TARGET_ARCHITECTURE_ARM
};
extern SPMI_TARGET_ARCHITECTURE SpmiTargetArchitecture;