Skip to content
Snippets Groups Projects
Commit f68dd8b4 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Fixed lepton include for asmjit

Reimported lepton fixing the include and ASMJIT guards.
parent 2b26c9fb
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
namespace PLMD { namespace PLMD {
using namespace lepton; using namespace lepton;
using namespace std; using namespace std;
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
using namespace asmjit; using namespace asmjit;
#endif #endif
...@@ -85,7 +85,7 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit ...@@ -85,7 +85,7 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit
if (operation[i]->getNumArguments() > maxArguments) if (operation[i]->getNumArguments() > maxArguments)
maxArguments = operation[i]->getNumArguments(); maxArguments = operation[i]->getNumArguments();
argValues.resize(maxArguments); argValues.resize(maxArguments);
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
generateJitCode(); generateJitCode();
#endif #endif
} }
...@@ -179,7 +179,7 @@ double& CompiledExpression::getVariableReference(const string& name) { ...@@ -179,7 +179,7 @@ double& CompiledExpression::getVariableReference(const string& name) {
void CompiledExpression::setVariableLocations(map<string, double*>& variableLocations) { void CompiledExpression::setVariableLocations(map<string, double*>& variableLocations) {
variablePointers = variableLocations; variablePointers = variableLocations;
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
// Rebuild the JIT code. // Rebuild the JIT code.
if (workspace.size() > 0) if (workspace.size() > 0)
...@@ -197,7 +197,7 @@ void CompiledExpression::setVariableLocations(map<string, double*>& variableLoca ...@@ -197,7 +197,7 @@ void CompiledExpression::setVariableLocations(map<string, double*>& variableLoca
} }
double CompiledExpression::evaluate() const { double CompiledExpression::evaluate() const {
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
return ((double (*)()) jitCode)(); return ((double (*)()) jitCode)();
#else #else
for (int i = 0; i < variablesToCopy.size(); i++) for (int i = 0; i < variablesToCopy.size(); i++)
...@@ -219,7 +219,7 @@ double CompiledExpression::evaluate() const { ...@@ -219,7 +219,7 @@ double CompiledExpression::evaluate() const {
#endif #endif
} }
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
static double evaluateOperation(Operation* op, double* args) { static double evaluateOperation(Operation* op, double* args) {
map<string, double>* dummyVariables = NULL; map<string, double>* dummyVariables = NULL;
return op->evaluate(args, *dummyVariables); return op->evaluate(args, *dummyVariables);
......
...@@ -71,8 +71,8 @@ ...@@ -71,8 +71,8 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
#include "asmjit.h" #include "asmjit/asmjit.h"
#endif #endif
namespace PLMD { namespace PLMD {
...@@ -133,7 +133,7 @@ private: ...@@ -133,7 +133,7 @@ private:
mutable std::vector<double> argValues; mutable std::vector<double> argValues;
std::map<std::string, double> dummyVariables; std::map<std::string, double> dummyVariables;
void* jitCode; void* jitCode;
#ifdef LEPTON_USE_JIT #ifdef __PLUMED_HAS_ASMJIT
void generateJitCode(); void generateJitCode();
void generateSingleArgCall(asmjit::X86Compiler& c, asmjit::X86XmmVar& dest, asmjit::X86XmmVar& arg, double (*function)(double)); void generateSingleArgCall(asmjit::X86Compiler& c, asmjit::X86XmmVar& dest, asmjit::X86XmmVar& arg, double (*function)(double));
std::vector<double> constants; std::vector<double> constants;
......
...@@ -21,7 +21,10 @@ cp $path/src/*.cpp $path/src/*.h . ...@@ -21,7 +21,10 @@ cp $path/src/*.cpp $path/src/*.h .
for file in *.h *.cpp ; do for file in *.h *.cpp ; do
sed 's|lepton/|| sed 's|lepton/||
s|Lepton|lepton|' $file > tmp s|Lepton|lepton|
s|LEPTON_USE_JIT|__PLUMED_HAS_ASMJIT|g
s|asmjit.h|asmjit/asmjit.h|g
' $file > tmp
mv tmp $file mv tmp $file
dos2unix $file dos2unix $file
done done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment