diff options
author | alon@honor <none@none> | 2010-10-06 20:43:30 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-06 20:43:30 -0700 |
commit | 636ca0d2b19455cac197e20f7dd81fd963bad685 (patch) | |
tree | c05de1a7fdc93ef41dadd9bf2165779d38a01c0c /src/jsifier.js | |
parent | 99f96653a706fc61d4be31ce8b45cd6d74c06c6a (diff) |
inline stack allocations
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 10f3851f..66beb0bf 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -545,10 +545,9 @@ function JSify(data) { makeFuncLineZyme('alloca', function(item) { dprint('alloca', dump(item)); if (pointingLevels(item.allocatedType.text) == 0 && isStructType(item.allocatedType.text)) { - // TODO: allocate on a stack, not on the heap (we currently leak all this) - return makePointer(JSON.stringify(makeEmptyStruct(item.allocatedType.text)), null, 'ALLOC_STACK'); + return RuntimeGenerator.stackAlloc(makeEmptyStruct(item.allocatedType.text).length); } else { - return makePointer('[0]', null, 'ALLOC_STACK'); + return RuntimeGenerator.stackAlloc(1); } }); makeFuncLineZyme('phi', function(item) { |