From a9d81338b19f21f7220e340a1c50870b40587120 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 15 Feb 2017 20:17:13 -0500 Subject: 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. --- tools/lexh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') 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", -- cgit 1.4.1