projects
/
fur
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
76ffe5a
)
Reuse the parent stack in current stack frame
author
David Kerkeslager
<kerkeslager@gmail.com>
Tue, 12 Dec 2017 23:58:42 +0000
(18:58 -0500)
committer
David Kerkeslager
<kerkeslager@gmail.com>
Tue, 12 Dec 2017 23:58:42 +0000
(18:58 -0500)
templates/function_definition.c
patch
|
blob
|
history
diff --git
a/templates/function_definition.c
b/templates/function_definition.c
index
9af7632
..
ce869b2
100644
(file)
--- a/
templates/function_definition.c
+++ b/
templates/function_definition.c
@@
-1,9
+1,8
@@
-Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environment* environment, size_t argc, Stack*
parentS
tack, jmp_buf parentJump)
+Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environment* environment, size_t argc, Stack*
s
tack, jmp_buf parentJump)
{
environment = Environment_construct(environmentPool, environment);
{
environment = Environment_construct(environmentPool, environment);
- Stack* stack = Stack_construct();
StackSnapshot stackSnapshot = Stack_takeSnapshot(stack);
jmp_buf jump;
StackSnapshot stackSnapshot = Stack_takeSnapshot(stack);
jmp_buf jump;
@@
-14,15
+13,13
@@
Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen
Stack_rewind(stack, stackSnapshot);
Environment_setLive(environment, false);
Stack_rewind(stack, stackSnapshot);
Environment_setLive(environment, false);
- Stack_destruct(stack);
-
longjmp(parentJump, 1);
}
Object result = builtin$nil;
{% for argument_name in argument_name_list|reverse %}
longjmp(parentJump, 1);
}
Object result = builtin$nil;
{% for argument_name in argument_name_list|reverse %}
- Environment_set(environment, "{{ argument_name }}", Stack_pop(
parentS
tack));
+ Environment_set(environment, "{{ argument_name }}", Stack_pop(
s
tack));
{% endfor %}
{% for statement in statement_list %}
{% endfor %}
{% for statement in statement_list %}
@@
-31,7
+28,5
@@
Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen
// TODO Set the environment back to the parent environment
Environment_setLive(environment, false);
// TODO Set the environment back to the parent environment
Environment_setLive(environment, false);
-
- Stack_destruct(stack);
return result;
}
return result;
}