Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

enabling encoder inlining

  • Loading branch information...
commit 72dd035a6fd3e54b240f2ca94d98ef3095afed35 1 parent db1f2e1
@nishiuramakoto authored
View
3  Makefile.am
@@ -39,4 +39,5 @@ dist_noinst_DATA = \
doc/Makefile \
doc/TexMakefile \
demo/Makefile \
- README.md
+ README.md \
+ LICENSE_1_0.txt
View
3  Makefile.in
@@ -284,7 +284,8 @@ dist_noinst_DATA = \
doc/Makefile \
doc/TexMakefile \
demo/Makefile \
- README.md
+ README.md \
+ LICENSE_1_0.txt
all: all-recursive
View
12 README
@@ -103,7 +103,7 @@ Please see the documentation for the detail.
MetaPrelude is a library for (untyped) lazy metaprogramming in C++
which tries to mimic Haskell as much as possible. It is used as the
backend of static type-level computation in ERASM++ and GenericDsm. I
-hope it should help implementing more complex EDSLs than the assembly
+hope it could help implementing more complex EDSLs than the assembly
language.
It is still far from complete, and the important design decisions are
@@ -115,9 +115,8 @@ Here is a list of important limitations:
* It is an untyped calculus.
-* It doesn't support lambdas (efficiently). You are expected to
- lambda-lift every unnamed function. This means that you can't have
- Haskell-style monads syntactically. You still have monads in
+* It doesn't support lambdas (efficiently). This means that you can't
+ have Haskell-style monads syntactically. You still have monads in
mathematical sense, of course, as monads are just an abstraction of
*actions* of monoids.
@@ -127,8 +126,9 @@ Here is a list of important limitations:
* Most importantly, the complexity of the program is dependent upon
the particular compiler implementation! Some compilers cache
- template instantiations, some do not, some in-between, and all this
- can make a difference of linear to super-exponential complexity.
+ template instantiations, some do not, some in-between at various
+ degrees, and all this can make a difference of linear to
+ super-exponential complexity.
For the moment, code is the only documentation. Please see the
following files if you are interested:
View
12 README.md
@@ -103,7 +103,7 @@ Please see the documentation for the detail.
MetaPrelude is a library for (untyped) lazy metaprogramming in C++
which tries to mimic Haskell as much as possible. It is used as the
backend of static type-level computation in ERASM++ and GenericDsm. I
-hope it should help implementing more complex EDSLs than the assembly
+hope it could help implementing more complex EDSLs than the assembly
language.
It is still far from complete, and the important design decisions are
@@ -115,9 +115,8 @@ Here is a list of important limitations:
* It is an untyped calculus.
-* It doesn't support lambdas (efficiently). You are expected to
- lambda-lift every unnamed function. This means that you can't have
- Haskell-style monads syntactically. You still have monads in
+* It doesn't support lambdas (efficiently). This means that you can't
+ have Haskell-style monads syntactically. You still have monads in
mathematical sense, of course, as monads are just an abstraction of
*actions* of monoids.
@@ -127,8 +126,9 @@ Here is a list of important limitations:
* Most importantly, the complexity of the program is dependent upon
the particular compiler implementation! Some compilers cache
- template instantiations, some do not, some in-between, and all this
- can make a difference of linear to super-exponential complexity.
+ template instantiations, some do not, some in-between at various
+ degrees, and all this can make a difference of linear to
+ super-exponential complexity.
For the moment, code is the only documentation. Please see the
following files if you are interested:
View
28 demo/dsm86_counter.cpp
@@ -1,24 +1,24 @@
#include <erasm/dsm_x86_util.hpp>
#include <erasm/dsm_x86.hpp>
+#include <iostream>
+using namespace std;
using namespace erasm::x86;
using namespace erasm::x86::addr32::data32;
struct MyCounter : public InstructionCounter
{
- InstructionCounter(const_code_ptr start)
+ MyCounter(const_code_ptr start)
: InstructionCounter(start)
{}
// Let the base class handle the default cases
using InstructionCounter::action;
- //
- using InstructionCounter::counter_;
action_result_type
action(const Ret& insn)
{
- counter_++;
+ inc_counter();
return finish(insn);
}
@@ -26,7 +26,25 @@ struct MyCounter : public InstructionCounter
action_result_type
action(const Jmp& insn,const Op& op)
{
- counter_++;
+ inc_counter();
return finish(insn);
}
};
+
+int main()
+{
+ const_code_ptr p = (const_code_ptr) main;
+ MyCounter mydsm(p);
+
+ const_code_ptr end = decode(p,mydsm);
+
+ if (mydsm.failed()) {
+ cerr << "Disassembly failed at:"
+ << hex << (void*)end << endl;
+ return 1;
+ }
+
+ cout << "number of instructions = " << mydsm.get_counter() << endl;
+
+ return 0;
+}
View
8 doc/manual.lhs
@@ -51,6 +51,12 @@
\tableofcontents
+\subsection*{Note}
+This manual is still only a rough sketch of the library.
+I am working on a better documentation, but if you have encountered a
+problem in using the library, please consider reporting it.
+
+
\section{Introduction}
\label{sec:introduction}
@@ -86,7 +92,7 @@ strengths are:
require any runtime support.
\item Near full conformance to the C++03 standard subject to the
limitations concerning the platform's data representations (see
- Section \ref{sec:erasm-limitations}).
+ Section \ref{sec:erasm-limitations} ).
\end{itemize}
Only the Intel 64/IA-32 architectures are supported at this moment.
View
BIN  doc/manual.pdf
Binary file not shown
View
8 doc/manual.tex
@@ -309,6 +309,12 @@
\tableofcontents
+\subsection*{Note}
+This manual is still only a rough sketch of the library.
+I am working on a better documentation, but if you have encountered a
+problem in using the library, please consider reporting it.
+
+
\section{Introduction}
\label{sec:introduction}
@@ -344,7 +350,7 @@ \subsection{Overview}
require any runtime support.
\item Near full conformance to the C++03 standard subject to the
limitations concerning the platform's data representations (see
- Section \ref{sec:erasm-limitations}).
+ Section \ref{sec:erasm-limitations} ).
\end{itemize}
Only the Intel 64/IA-32 architectures are supported at this moment.
View
12 src/erasm/dsm_x64_util.hpp
@@ -91,13 +91,12 @@ class InstructionCounter : public DsmBase
int get_counter() const
{ return counter_ ; }
-
template<class Insn>
action_result_type
action(const Insn& insn)
{
- counter_ ++;
+ inc_counter();
return next(insn);
}
@@ -106,7 +105,7 @@ class InstructionCounter : public DsmBase
action(const Insn& insn,
const Op1& op1)
{
- counter_ ++;
+ inc_counter();
return next(insn);
}
@@ -116,7 +115,7 @@ class InstructionCounter : public DsmBase
const Op1& op1,
const Op2& op2)
{
- counter_ ++;
+ inc_counter();
return next(insn);
}
@@ -127,11 +126,14 @@ class InstructionCounter : public DsmBase
const Op2& op2,
const Op3& op3)
{
- counter_ ++;
+ inc_counter();
return next(insn);
}
protected:
+ void inc_counter()
+ { counter_ ++ ; }
+
int counter_;
};
View
2  src/erasm/dsm_x86_util.hpp
@@ -7,6 +7,8 @@
namespace erasm { namespace x86 {
+using x64::DsmBase;
+using x64::InstructionCounter;
using x64::SimpleDsm;
}}
View
4,066 src/erasm/x86_addr32_data32.cpp
2,033 additions, 2,033 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.