Skip to content

Commit

Permalink
Rewrite runtime, switch to tracing GC and bootstrap (AssemblyScript#1559
Browse files Browse the repository at this point in the history
)

BREAKING: The exported runtime interface has changed, affecting how external objects are being kept alive. Please refer to the updated documentation on [Garbage collection](https://www.assemblyscript.org/garbage-collection.html) for all the details.
  • Loading branch information
dcodeIO authored Jan 28, 2021
1 parent ffdf411 commit b857944
Show file tree
Hide file tree
Showing 640 changed files with 545,120 additions and 251,713 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist/
docs/
lib/binaryen.js
lib/parse/index.js
out/
raw/
Expand Down
48 changes: 25 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ jobs:
run: npm test
- name: Test browser build
run: node tests/browser-asc
test-bootstrap:
name: "Compiler (Bootstrap)"
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/[email protected]
- uses: dcodeIO/setup-node-nvm@master
with:
node-version: current
- name: Install dependencies
run: npm ci --no-audit
- name: Clean distribution files
run: npm run clean
- name: Bootstrap the compiler
run: npm run bootstrap
- name: Run compiler tests (untouched-bootstrap)
run: npm run test:compiler -- --wasm out/assemblyscript.untouched-bootstrap.wasm
- name: Run compiler tests (optimized-bootstrap)
run: npm run test:compiler -- --wasm out/assemblyscript.optimized-bootstrap.wasm
test-features:
name: "Features"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -134,18 +153,18 @@ jobs:
run: npm ci --no-audit
- name: Clean distribution files
run: npm run clean
- name: Test full runtime
- name: Test default allocator
run: |
cd tests/allocators/rt-full
cd tests/allocators/default
npm run build
cd ..
npm test rt-full
- name: Test stub runtime
npm test default
- name: Test stub allocator
run: |
cd tests/allocators/rt-stub
cd tests/allocators/stub
npm run build
cd ..
npm test rt-stub
npm test stub
test-loader:
name: "Loader"
runs-on: ubuntu-latest
Expand All @@ -164,20 +183,3 @@ jobs:
cd lib/loader
npm run asbuild
npm run test
test-bootstrap:
name: "Bootstrap"
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/[email protected]
- uses: dcodeIO/setup-node-nvm@master
with:
node-version: current
- name: Install dependencies
run: npm ci --no-audit
- name: Clean distribution files
run: npm run clean
- name: Test self-compilation
run: |
npm run asbuild
npm run astest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ out/
raw/
.history
*.backup
.vscode
.vscode
.idea
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ under the licensing terms detailed in LICENSE:
* Gabor Greif <[email protected]>
* Martin Fredriksson <[email protected]>
* forcepusher <[email protected]>
* Piotr Oleś <[email protected]>

Portions of this software are derived from third-party works licensed under
the following terms:
Expand Down
37 changes: 36 additions & 1 deletion cli/asc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,39 @@ export interface MemoryStream extends OutputStream {
toString(): string;
}

/** Relevant subset of the Source class for diagnostic reporting. */
export interface Source {
/** Normalized path with file extension. */
normalizedPath: string;
}

/** Relevant subset of the Range class for diagnostic reporting. */
export interface Range {
/** Start offset within the source file. */
start: number;
/** End offset within the source file. */
end: number;
/** Respective source file. */
source: Source;
}

/** Relevant subset of the DiagnosticMessage class for diagnostic reporting. */
export interface DiagnosticMessage {
/** Message code. */
code: number;
/** Message category. */
category: number;
/** Message text. */
message: string;
/** Respective source range, if any. */
range: Range | null;
/** Related range, if any. */
relatedRange: Range | null;
}

/** A function handling diagnostic messages. */
type DiagnosticReporter = (diagnostic: DiagnosticMessage) => void;

/** Compiler options. */
export interface CompilerOptions {
/** Prints just the compiler's version and exits. */
Expand Down Expand Up @@ -157,6 +190,8 @@ export interface APIOptions {
writeFile?: (filename: string, contents: Uint8Array, baseDir: string) => void;
/** Lists all files within a directory. */
listFiles?: (dirname: string, baseDir: string) => string[] | null;
/** Handler for diagnostic messages. */
reportDiagnostic?: DiagnosticReporter;
}

/** Convenience function that parses and compiles source strings directly. */
Expand All @@ -176,7 +211,7 @@ export function main(argv: string[], options: APIOptions, callback?: (err: Error
export function main(argv: string[], callback?: (err: Error | null) => number): number;

/** Checks diagnostics emitted so far for errors. */
export function checkDiagnostics(emitter: Record<string,unknown>, stderr?: OutputStream): boolean;
export function checkDiagnostics(emitter: Record<string,unknown>, stderr?: OutputStream, reportDiagnostic?: DiagnosticReporter): boolean;

/** An object of stats for the current task. */
export interface Stats {
Expand Down
Loading

0 comments on commit b857944

Please sign in to comment.