Implement function types / indirect calls / trampolines (#39)

This commit is contained in:
Daniel Wirtz
2018-03-12 14:06:39 +01:00
committed by GitHub
parent 5d5f458ab1
commit 423533c6b0
67 changed files with 7499 additions and 5763 deletions

View File

@ -61,7 +61,7 @@ const MIN_ALLOC: usize = 1 << MIN_ALLOC_LOG2;
* heaps will have multiple allocations, so the real maximum allocation limit
* is at most 1gb.
*/
const MAX_ALLOC_LOG2: usize = 31;
const MAX_ALLOC_LOG2: usize = 30; // 31;
const MAX_ALLOC: usize = 1 << MAX_ALLOC_LOG2;
/*
@ -338,7 +338,7 @@ function lower_bucket_limit(bucket: usize): u32 {
}
@global
function allocate_memory(request: usize): usize {
export function allocate_memory(request: usize): usize {
var original_bucket: usize, bucket: usize;
/*
@ -475,7 +475,7 @@ function allocate_memory(request: usize): usize {
}
@global
function free_memory(ptr: usize): void {
export function free_memory(ptr: usize): void {
var bucket: usize, i: usize;
/*
@ -539,3 +539,8 @@ function free_memory(ptr: usize): void {
*/
list_push(buckets$get(bucket), changetype<List>(ptr_for_node(i, bucket)));
}
@global
export function reset_memory(): void {
unreachable();
}