diff options
author | alon@honor <none@none> | 2010-10-02 12:03:07 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-02 12:03:07 -0700 |
commit | 51d1c32a775cbb4ac578911fe1ae03b064a792bd (patch) | |
tree | a9903e22ed5bcfba177bad8f93c12268b5f61279 /src/library.js | |
parent | a3f35c0ffd4b6c3e38752ea8ff1e3fc2101a313b (diff) |
memory implementation cleanup
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js index 72d7f599..ad8e440f 100644 --- a/src/library.js +++ b/src/library.js @@ -139,7 +139,7 @@ var Library = { }, llvm_eh_exception: function() { - return 'code-generated exception'; + return 'code-generated exception: ' + (new Error().stack); }, llvm_eh_selector: function(exception, personality, num) { @@ -188,13 +188,24 @@ var Library = { sysconf: function(name_) { switch(name_) { - case 30: return 4096; // _SC_PAGE_SIZE + case 30: return PAGE_SIZE; // _SC_PAGE_SIZE default: throw 'unknown sysconf param: ' + name_; } }, sbrk: function(bytes) { - return unfreeableMalloc(bytes); + // We need to make sure no one else allocates unfreeable memory! + // We must control this entirely. So we don't even need to do + // unfreeable allocations - the HEAP is ours, from HEAPTOP up. + // TODO: We could in theory slice off the top of the HEAP when + // sbrk gets a negative increment in |bytes|... + var self = arguments.callee; + if (!self.HEAPTOP) { + self.HEAPTOP = HEAPTOP; + } else { + assert(self.HEAPTOP == HEAPTOP, "Noone should touch the heap!"); + } + return alignMemoryPage(HEAPTOP); }, // time.h |