[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
Török Edvin
edwin at clamav.net
Sun Apr 4 01:23:34 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 09667cdd3ba50f43686129c1a27134c9a54f90da
Author: Török Edvin <edwin at clamav.net>
Date: Sun Mar 21 15:44:07 2010 +0200
Print size and location of JITed code.
diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp
index e9cbf86..bdbd0b9 100644
--- a/libclamav/c++/bytecode2llvm.cpp
+++ b/libclamav/c++/bytecode2llvm.cpp
@@ -104,6 +104,7 @@ struct cli_bcengine {
} guard;
};
+extern "C" uint8_t cli_debug_flag;
namespace {
static sys::ThreadLocal<const jmp_buf> ExceptionReturn;
@@ -203,6 +204,21 @@ static void* noUnknownFunctions(const std::string& name) {
return 0;
}
+class NotifyListener : public JITEventListener {
+public:
+ virtual void NotifyFunctionEmitted(const Function &F,
+ void *Code, size_t Size,
+ const EmittedFunctionDetails &Details)
+ {
+ if (!cli_debug_flag)
+ return;
+ errs() << "bytecode JIT: emitted function " << F.getName() <<
+ " of " << Size << " bytes at 0x";
+ errs().write_hex((uintptr_t)Code);
+ errs() << "\n";
+ }
+};
+
class LLVMTypeMapper {
private:
std::vector<PATypeHolder> TypeMap;
@@ -339,7 +355,11 @@ private:
unsigned map[] = {0, 1, 2, 3, 3, 4, 4, 4, 4};
if (operand < func->numValues)
return Values[operand];
- unsigned w = (Ty->getPrimitiveSizeInBits()+7)/8;
+ unsigned w = Ty->getPrimitiveSizeInBits();
+ if (w > 1)
+ w = (w+7)/8;
+ else
+ w = 0;
return convertOperand(func, map[w], operand);
}
@@ -366,7 +386,11 @@ private:
}
return V;
}
- unsigned w = (Ty->getPrimitiveSizeInBits()+7)/8;
+ unsigned w = Ty->getPrimitiveSizeInBits();
+ if (w > 1)
+ w = (w+7)/8;
+ else
+ w = 0;
return convertOperand(func, map[w], operand);
}
@@ -1356,6 +1380,7 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs)
return CL_EBYTECODE;
}
+ EE->RegisterJITEventListener(new NotifyListener());
// EE->RegisterJITEventListener(createOProfileJITEventListener());
// Due to LLVM PR4816 only X86 supports non-lazy compilation, disable
// for now.
@@ -1503,7 +1528,6 @@ int bytecode_init(void)
return 0;
}
-extern "C" uint8_t cli_debug_flag;
// Called once when loading a new set of BC files
int cli_bytecode_init_jit(struct cli_all_bc *bcs, unsigned dconfmask)
{
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list