Permalink
Browse files

Clean up code in readme

Signed-off-by: Lucas de Vries <lucas@glacicle.org>
  • Loading branch information...
1 parent 8bfed40 commit 670eb13d30d8d4f0bb48109b45f79ed635a26bf6 @GGLucas GGLucas committed Feb 14, 2012
Showing with 37 additions and 26 deletions.
  1. +37 −26 README.md
View
@@ -29,31 +29,42 @@ When including files into the project, choose one of "virtual_asm_windows.cpp" a
#include "as_jit.h"
int main() {
- asIScriptEngine* engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
- //Create the JIT Compiler. The build flags are explained elsewhere, as well as in as_jit.h
- asCJitCompiler* jit = new asCJITCompiler(0);
-
- //Enable JIT helper instructions; without these, the JIT will not be invoked
- engine->SetEngineProperty(asEP_INCLUDE_JIT_INSTRUCTIONS, 1);
- //Bind the JIT compiler to the engine
- engine->SetJITCompiler(jit);
-
- //Load your scripts. The JIT will allocate code pages and build native code; note that some native execution will occurs (e.g. for global variables)
- //The JIT is thread-safe, so multiple engines can use the same JIT Compiler, and multiple engines can be compiling at once
- LoadAndCompileScripts();
-
- //Optionally, you can finalize the JIT's code pages, preventing any alteration to the native code
- jit->finalizePages();
-
- //Now that the JIT is in place, the scripts will be executed almost entirely in native code
- RunScripts();
-
- //Clean up your engine. Code pages will automatically be cleared by the JIT when the engine is released.
- DiscardModules();
- engine->Release();
- delete jit;
-
- return 0;
+ asIScriptEngine* engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
+
+ //Create the JIT Compiler. The build flags are explained below,
+ //as well as in as_jit.h
+ asCJitCompiler* jit = new asCJITCompiler(0);
+
+ //Enable JIT helper instructions; without these,
+ //the JIT will not be invoked
+ engine->SetEngineProperty(asEP_INCLUDE_JIT_INSTRUCTIONS, 1);
+
+ //Bind the JIT compiler to the engine
+ engine->SetJITCompiler(jit);
+
+ //Load your scripts. The JIT will allocate code pages and build
+ //native code; note that some native execution will occur
+ //(e.g. for global variables)
+
+ //The JIT is thread-safe, so multiple engines can use the same
+ //JIT Compiler, and multiple engines can be compiling at once
+ LoadAndCompileScripts();
+
+ //Optionally, you can finalize the JIT's code pages,
+ //preventing any alteration to the native code
+ jit->finalizePages();
+
+ //Now that the JIT is in place, the scripts will be executed
+ //almost entirely in native code
+ RunScripts();
+
+ //Clean up your engine. Code pages will automatically be cleared
+ //by the JIT when the engine is released.
+ DiscardModules();
+ engine->Release();
+ delete jit;
+
+ return 0;
}
Build Flags
@@ -77,4 +88,4 @@ When using simple allocation (e.g. default new/delete or malloc/free) that does
*JIT_NO_SWITCHES*
-Disables native switch statements in the JIT. Native switches currently use a rather large amount of memory; disable this option for a smaller, but slower, output.
+Disables native switch statements in the JIT. Native switches currently use a rather large amount of memory; disable this option for a smaller, but slower, output.

0 comments on commit 670eb13

Please sign in to comment.