From 36bf506ad3c99a309ca8bd73bd03563d8d068ac0 Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Wed, 4 Nov 2009 14:58:56 +0000 Subject: Update LLVM to r86025. --- docs/tutorial/LangImpl4.html | 35 +++++++++++++++-------------------- docs/tutorial/OCamlLangImpl4.html | 31 +++++++++++++------------------ 2 files changed, 28 insertions(+), 38 deletions(-) (limited to 'docs/tutorial') diff --git a/docs/tutorial/LangImpl4.html b/docs/tutorial/LangImpl4.html index 3188135384e0e..728d518a473bf 100644 --- a/docs/tutorial/LangImpl4.html +++ b/docs/tutorial/LangImpl4.html @@ -388,24 +388,19 @@ entry: -

This illustrates that we can now call user code, but there is something a bit subtle -going on here. Note that we only invoke the JIT on the anonymous functions -that call testfunc, but we never invoked it on testfunc -itself.

- -

What actually happened here is that the anonymous function was -JIT'd when requested. When the Kaleidoscope app calls through the function -pointer that is returned, the anonymous function starts executing. It ends up -making the call to the "testfunc" function, and ends up in a stub that invokes -the JIT, lazily, on testfunc. Once the JIT finishes lazily compiling testfunc, -it returns and the code re-executes the call.

- -

In summary, the JIT will lazily JIT code, on the fly, as it is needed. The -JIT provides a number of other more advanced interfaces for things like freeing -allocated machine code, rejit'ing functions to update them, etc. However, even -with this simple code, we get some surprisingly powerful capabilities - check -this out (I removed the dump of the anonymous functions, you should get the idea -by now :) :

+

This illustrates that we can now call user code, but there is something a bit +subtle going on here. Note that we only invoke the JIT on the anonymous +functions that call testfunc, but we never invoked it +on testfunc itself. What actually happened here is that the JIT +scanned for all non-JIT'd functions transitively called from the anonymous +function and compiled all of them before returning +from getPointerToFunction().

+ +

The JIT provides a number of other more advanced interfaces for things like +freeing allocated machine code, rejit'ing functions to update them, etc. +However, even with this simple code, we get some surprisingly powerful +capabilities - check this out (I removed the dump of the anonymous functions, +you should get the idea by now :) :

@@ -453,8 +448,8 @@ directly.

resolved. It allows you to establish explicit mappings between IR objects and addresses (useful for LLVM global variables that you want to map to static tables, for example), allows you to dynamically decide on the fly based on the -function name, and even allows you to have the JIT abort itself if any lazy -compilation is attempted.

+function name, and even allows you to have the JIT compile functions lazily the +first time they're called.

One interesting application of this is that we can now extend the language by writing arbitrary C++ code to implement operations. For example, if we add: diff --git a/docs/tutorial/OCamlLangImpl4.html b/docs/tutorial/OCamlLangImpl4.html index 26f253249bb1c..543e12fe25b26 100644 --- a/docs/tutorial/OCamlLangImpl4.html +++ b/docs/tutorial/OCamlLangImpl4.html @@ -406,22 +406,17 @@ entry:

This illustrates that we can now call user code, but there is something a bit subtle going on here. Note that we only invoke the JIT on the anonymous -functions that call testfunc, but we never invoked it on testfunc -itself.

- -

What actually happened here is that the anonymous function was JIT'd when -requested. When the Kaleidoscope app calls through the function pointer that is -returned, the anonymous function starts executing. It ends up making the call -to the "testfunc" function, and ends up in a stub that invokes the JIT, lazily, -on testfunc. Once the JIT finishes lazily compiling testfunc, -it returns and the code re-executes the call.

- -

In summary, the JIT will lazily JIT code, on the fly, as it is needed. The -JIT provides a number of other more advanced interfaces for things like freeing -allocated machine code, rejit'ing functions to update them, etc. However, even -with this simple code, we get some surprisingly powerful capabilities - check -this out (I removed the dump of the anonymous functions, you should get the idea -by now :) :

+functions that call testfunc, but we never invoked it +on testfunc itself. What actually happened here is that the JIT +scanned for all non-JIT'd functions transitively called from the anonymous +function and compiled all of them before returning +from run_function.

+ +

The JIT provides a number of other more advanced interfaces for things like +freeing allocated machine code, rejit'ing functions to update them, etc. +However, even with this simple code, we get some surprisingly powerful +capabilities - check this out (I removed the dump of the anonymous functions, +you should get the idea by now :) :

@@ -467,8 +462,8 @@ calls in the module to call the libm version of sin directly.

get resolved. It allows you to establish explicit mappings between IR objects and addresses (useful for LLVM global variables that you want to map to static tables, for example), allows you to dynamically decide on the fly based on the -function name, and even allows you to have the JIT abort itself if any lazy -compilation is attempted.

+function name, and even allows you to have the JIT compile functions lazily the +first time they're called.

One interesting application of this is that we can now extend the language by writing arbitrary C code to implement operations. For example, if we add: -- cgit v1.2.3