summary refs log tree commit diff
path: root/tools/lexh.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2017-02-15 20:17:13 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2017-02-15 20:17:13 -0500
commita9d81338b19f21f7220e340a1c50870b40587120 (patch)
tree509f8ec05d8b8da88b90630031cff5b52b2e5c54 /tools/lexh.c
parent249af91ff9d9ffbd8962efcad999de442e609658 (diff)
downloadroux-a9d81338b19f21f7220e340a1c50870b40587120.tar.gz
add support for closure calls
Compiling languages with closures often requires passing
an extra environment parameter to the called function.

One solution is to use a convention, and reserve, say,
the first argument for that purpose.   However, that
makes binding to C a little less smooth.

Alternatively, QBE now provides a way to remain fully
ABI compatible with C by having a "hidden" environment
argument (marked with the keyword 'env').  Calling a
function expecting an environment from C will make the
contents of the environment undefined, but the normal
arguments will be passed without alteration.  Conversely,
calling a C function like it is a closure by passing
it an environemnt will work smoothly.
Diffstat (limited to 'tools/lexh.c')
-rw-r--r--tools/lexh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lexh.c b/tools/lexh.c
index db27f8f..9e8016a 100644
--- a/tools/lexh.c
+++ b/tools/lexh.c
@@ -22,7 +22,7 @@ char *tok[] = {
 	"ceql", "cnel", "cles", "clts", "cgts", "cges",
 	"cnes", "ceqs", "cos", "cuos", "cled", "cltd",
 	"cgtd", "cged", "cned", "ceqd", "cod", "cuod",
-	"vaarg", "vastart", "...",
+	"vaarg", "vastart", "...", "env",
 
 	"call", "phi", "jmp", "jnz", "ret", "export",
 	"function", "type", "data", "align", "l", "w",