mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
llvm-like naming of __heap_base, definition fixes, update examples
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
export { __alloc } from "rt/tlsf";
|
||||
export { __retain, __release, __collect } from "rt/pure";
|
||||
export { RTTI_BASE as __rtti } from "rt";
|
||||
export { __rtti_base } from "rt";
|
||||
|
@ -1,2 +1,2 @@
|
||||
export { __alloc, __retain, __release, __collect } from "rt/stub";
|
||||
export { RTTI_BASE as __rtti } from "rt";
|
||||
export { __rtti_base } from "rt";
|
||||
|
@ -64,7 +64,7 @@ import { onincrement, ondecrement, onfree, onalloc } from "./rtrace";
|
||||
// @ts-ignore: decorator
|
||||
@global @unsafe
|
||||
function __visit(ref: usize, cookie: i32): void {
|
||||
if (ref < HEAP_BASE) return;
|
||||
if (ref < __heap_base) return;
|
||||
var s = changetype<Block>(ref - BLOCK_OVERHEAD);
|
||||
switch (cookie) {
|
||||
case VISIT_DECREMENT: {
|
||||
@ -251,12 +251,12 @@ function collectWhite(s: Block): void {
|
||||
// @ts-ignore: decorator
|
||||
@global @unsafe
|
||||
export function __retain(ref: usize): usize {
|
||||
if (ref > HEAP_BASE) increment(changetype<Block>(ref - BLOCK_OVERHEAD));
|
||||
if (ref > __heap_base) increment(changetype<Block>(ref - BLOCK_OVERHEAD));
|
||||
return ref;
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@global @unsafe
|
||||
export function __release(ref: usize): void {
|
||||
if (ref > HEAP_BASE) decrement(changetype<Block>(ref - BLOCK_OVERHEAD));
|
||||
if (ref > __heap_base) decrement(changetype<Block>(ref - BLOCK_OVERHEAD));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { AL_MASK, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE } from "rt/common";
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@lazy
|
||||
var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK;
|
||||
var startOffset: usize = (__heap_base + AL_MASK) & ~AL_MASK;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@lazy
|
||||
|
@ -450,7 +450,7 @@ function prepareSize(size: usize): usize {
|
||||
|
||||
/** Initilizes the root structure. */
|
||||
export function initializeRoot(): void {
|
||||
var rootOffset = (HEAP_BASE + AL_MASK) & ~AL_MASK;
|
||||
var rootOffset = (__heap_base + AL_MASK) & ~AL_MASK;
|
||||
var pagesBefore = memory.size();
|
||||
var pagesNeeded = <i32>((((rootOffset + ROOT_SIZE) + 0xffff) & ~0xffff) >>> 16);
|
||||
if (pagesNeeded > pagesBefore && memory.grow(pagesNeeded - pagesBefore) < 0) unreachable();
|
||||
|
Reference in New Issue
Block a user