JitRegister: overload Register with a [start,end) variant

This commit is contained in:
Gabriel Corona 2015-01-05 20:24:37 +01:00
parent a957f93532
commit a4adfe194a
3 changed files with 25 additions and 8 deletions

View File

@ -71,18 +71,15 @@ void Shutdown()
s_perf_map_file.Close();
}
void Register(const void* base_address, u32 code_size,
const char* format, ...)
void RegisterV(const void* base_address, u32 code_size,
const char* format, va_list args)
{
#if !(defined USE_OPROFILE && USE_OPROFILE) && !defined(USE_VTUNE)
if (!s_perf_map_file.IsOpen())
return;
#endif
va_list args;
va_start(args, format);
std::string symbol_name = StringFromFormatV(format, args);
va_end(args);
#if defined USE_OPROFILE && USE_OPROFILE
op_write_native_code(s_agent, symbol_name.data(), (u64)base_address,

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#pragma once
#include <stdarg.h>
#include "Common/CommonTypes.h"
namespace JitRegister
@ -10,7 +11,26 @@ namespace JitRegister
void Init();
void Shutdown();
void Register(const void* base_address, u32 code_size,
const char* format, ...);
void RegisterV(const void* base_address, u32 code_size,
const char* format, va_list args);
inline void Register(const void* base_address, u32 code_size,
const char* format, ...)
{
va_list args;
va_start(args, format);
RegisterV(base_address, code_size, format, args);
va_end(args);
}
inline void Register(const void* start, const void* end,
const char* format, ...)
{
va_list args;
va_start(args, format);
u32 code_size = (u32) ((const char*) end - (const char*) start);
RegisterV(start, code_size, format, args);
va_end(args);
}
}

View File

@ -33,7 +33,7 @@ VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att):
std::string name;
AppendToString(&name);
JitRegister::Register(region, (u32)(GetCodePtr() - region), name.c_str());
JitRegister::Register(region, GetCodePtr(), name.c_str());
}
OpArg VertexLoaderX64::GetVertexAddr(int array, u64 attribute)