mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 17:31:29 +00:00
inline single-use implementations
This commit is contained in:
@ -10,7 +10,7 @@ var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK;
|
||||
var offset: usize = startOffset;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_allocate(size: usize): usize {
|
||||
if (size > MAX_SIZE_32) unreachable();
|
||||
var ptr = offset;
|
||||
@ -30,12 +30,12 @@ function __memory_allocate(size: usize): usize {
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_free(ptr: usize): void {
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_reset(): void {
|
||||
offset = startOffset;
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ declare function _malloc(size: usize): usize;
|
||||
declare function _free(ptr: usize): void;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_allocate(size: usize): usize {
|
||||
return _malloc(size);
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_free(ptr: usize): void {
|
||||
_free(ptr);
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ declare function malloc(size: usize): usize;
|
||||
declare function free(ptr: usize): void;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_allocate(size: usize): usize {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_free(ptr: usize): void {
|
||||
free(ptr);
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ var ROOT: Root = changetype<Root>(0);
|
||||
|
||||
/** Allocates a chunk of memory. */
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_allocate(size: usize): usize {
|
||||
// initialize if necessary
|
||||
var root = ROOT;
|
||||
@ -473,7 +473,7 @@ function __memory_allocate(size: usize): usize {
|
||||
|
||||
/** Frees the chunk of memory at the specified address. */
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @global
|
||||
@unsafe @global @inline
|
||||
function __memory_free(data: usize): void {
|
||||
if (data) {
|
||||
let root = ROOT;
|
||||
|
Reference in New Issue
Block a user