diff --git a/package.json b/package.json
index 3ae7238df0..42de12a8e9 100644
--- a/package.json
+++ b/package.json
@@ -20,14 +20,14 @@
"build": "dotenv -- turbo build",
"build:control": "rollup -c rollup.config.mjs",
"build:flags": "RETAIN_FLAGS=true ember build --env production --suppress-sizes",
- "link:all": "esyes ./bin/link-all.mts",
"clean": "node ./bin/clean.mjs",
+ "link:all": "esyes ./bin/link-all.mts",
"lint": "npm-run-all lint:*",
"lint:files": "turbo lint",
"lint:format": "prettier -c .",
"lint:types": "tsc -b",
"lintfix": "pnpm turbo test:lint -- --fix && prettier -w .",
- "start": "ember serve --port=7357",
+ "start": "vite",
"test": "node bin/run-tests.mjs",
"test:babel-plugins": "yarn workspace @glimmer/vm-babel-plugins test",
"test:browserstack": "ember test --test-port=7774 --host 127.0.0.1 --config-file=testem-browserstack.js",
diff --git a/packages/@glimmer-workspace/build/index.d.ts b/packages/@glimmer-workspace/build/index.d.ts
index 8442f97f0b..1315026703 100644
--- a/packages/@glimmer-workspace/build/index.d.ts
+++ b/packages/@glimmer-workspace/build/index.d.ts
@@ -4,4 +4,3 @@ export {
type PackageJSON,
type ViteConfig as ViteExport,
} from './lib/config.js';
-export { default as importMeta } from './lib/import-meta.js';
diff --git a/packages/@glimmer-workspace/build/index.js b/packages/@glimmer-workspace/build/index.js
index 480f7fba41..b16a2c80cf 100644
--- a/packages/@glimmer-workspace/build/index.js
+++ b/packages/@glimmer-workspace/build/index.js
@@ -1,3 +1,2 @@
export { Package } from './lib/config.js';
-export { default as importMeta } from './lib/import-meta.js';
export { default as inline } from './lib/inline.js';
diff --git a/packages/@glimmer-workspace/build/lib/config.js b/packages/@glimmer-workspace/build/lib/config.js
index 316790b915..07945878ba 100644
--- a/packages/@glimmer-workspace/build/lib/config.js
+++ b/packages/@glimmer-workspace/build/lib/config.js
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
// @ts-check
-
import { existsSync, readFileSync } from 'node:fs';
+import { createRequire } from 'node:module';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -11,9 +11,10 @@ import * as insert from 'rollup-plugin-insert';
import rollupTS from 'rollup-plugin-ts';
import ts from 'typescript';
-import importMeta from './import-meta.js';
import inline from './inline.js';
+const require = createRequire(import.meta.url);
+
// eslint-disable-next-line import/no-named-as-default-member
const { ModuleKind, ModuleResolutionKind, ScriptTarget, ImportsNotUsedAsValues } = ts;
@@ -96,7 +97,10 @@ export function typescript(pkg, config) {
return rollupTS({
transpiler: 'babel',
transpileOnly: true,
- babelConfig: { presets },
+ babelConfig: {
+ presets,
+ plugins: [require.resolve('@glimmer/local-debug-babel-plugin')],
+ },
/**
* This shouldn't be required, but it is.
* If we use @rollup/plugin-babel, we can remove this.
@@ -108,7 +112,7 @@ export function typescript(pkg, config) {
/** @type {['is' | 'startsWith', string[], 'inline' | 'external'][]} */
const EXTERNAL_OPTIONS = [
- ['is', ['tslib', '@glimmer/local-debug-flags'], 'inline'],
+ ['is', ['tslib', '@glimmer/local-debug-flags', '@glimmer/debug'], 'inline'],
['is', ['@handlebars/parser', 'simple-html-tokenizer', 'babel-plugin-debug-macros'], 'external'],
['startsWith', ['.', '/', '#', '@babel/runtime/', process.cwd().replace(/\\/gu, '/')], 'inline'],
['startsWith', ['@glimmer/', '@simple-dom/', '@babel/', 'node:'], 'external'],
@@ -315,7 +319,31 @@ export class Package {
commonjs(),
nodeResolve(),
...this.replacements(env),
- ...(env === 'prod' ? [terser()] : []),
+ ...(env === 'prod'
+ ? [
+ terser({
+ module: true,
+ // to debug the output, uncomment this so you can read the
+ // identifiers, unchanged
+ // mangle: false,
+ compress: {
+ passes: 3,
+ },
+ }),
+ ]
+ : [
+ terser({
+ module: true,
+ mangle: false,
+ compress: {
+ passes: 3,
+ },
+ format: {
+ comments: 'all',
+ beautify: true,
+ },
+ }),
+ ]),
postcss(),
typescript(this.#package, {
target: ScriptTarget.ES2022,
@@ -356,7 +384,20 @@ export class Package {
*/
replacements(env) {
return env === 'prod'
- ? [importMeta]
+ ? [
+ replace({
+ preventAssignment: true,
+ values: {
+ // Intended to be left in the build during publish
+ // currently compiled away to `@glimmer/debug`
+ 'import.meta.env.MODE': '"production"',
+ 'import.meta.env.DEV': 'false',
+ 'import.meta.env.PROD': 'true',
+ // Not exposed at publish, compiled away
+ 'import.meta.env.VM_LOCAL_DEV': 'false',
+ },
+ }),
+ ]
: [
replace({
preventAssignment: true,
@@ -417,10 +458,15 @@ export class Package {
return {
input: resolve(root, ts),
+ treeshake: {
+ // moduleSideEffects: false,
+ moduleSideEffects: (id, external) => !external,
+ },
output: {
file: resolve(root, 'dist', env, file),
format,
sourcemap: true,
+ hoistTransitiveImports: false,
exports: format === 'cjs' ? 'named' : 'auto',
},
onwarn: (warning, warn) => {
diff --git a/packages/@glimmer-workspace/build/lib/import-meta.d.ts b/packages/@glimmer-workspace/build/lib/import-meta.d.ts
deleted file mode 100644
index ecf41190e4..0000000000
--- a/packages/@glimmer-workspace/build/lib/import-meta.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-// eslint-disable-next-line @typescript-eslint/consistent-type-imports
-declare const DEFAULT: import('rollup').Plugin;
-
-export default DEFAULT;
diff --git a/packages/@glimmer-workspace/build/lib/import-meta.js b/packages/@glimmer-workspace/build/lib/import-meta.js
deleted file mode 100644
index 922271f533..0000000000
--- a/packages/@glimmer-workspace/build/lib/import-meta.js
+++ /dev/null
@@ -1,23 +0,0 @@
-///
-
-import { createReplacePlugin } from './replace.js';
-
-const MODE = process.env['MODE'] ?? 'development';
-const DEV = MODE === 'development';
-const PROD = MODE === 'production';
-const STARBEAM_TRACE = process.env['STARBEAM_TRACE'] ?? false;
-
-export default createReplacePlugin(
- (id) => /\.[jt]sx?$/u.test(id),
- {
- // Intended to be left in the build during publish
- // currently compiled away to `@glimmer/debug`
- 'import.meta.env.MODE': process.env['MODE'] ?? 'development',
- 'import.meta.env.DEV': DEV ? 'true' : 'false',
- 'import.meta.env.PROD': PROD ? 'true' : 'false',
- // Not exposed at publish, compiled away
- 'import.meta.env.VM_LOCAL_DEV': DEV ? 'true' : 'false',
- 'import.meta.env.STARBEAM_TRACE': STARBEAM_TRACE ? 'true' : 'false',
- },
- true
-);
diff --git a/packages/@glimmer-workspace/build/package.json b/packages/@glimmer-workspace/build/package.json
index 3dd515f7c6..8705cec9ca 100644
--- a/packages/@glimmer-workspace/build/package.json
+++ b/packages/@glimmer-workspace/build/package.json
@@ -13,6 +13,7 @@
"test:types": "tsc --noEmit -p ../tsconfig.json"
},
"dependencies": {
+ "@glimmer/local-debug-babel-plugin": "workspace:*",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
diff --git a/packages/@glimmer/debug/index.ts b/packages/@glimmer/debug/index.ts
index b05cc97099..d8aa97aa18 100644
--- a/packages/@glimmer/debug/index.ts
+++ b/packages/@glimmer/debug/index.ts
@@ -1,4 +1,54 @@
export { debug, debugSlice, logOpcode } from './lib/debug';
-export * from './lib/metadata';
+export {
+ buildEnum,
+ buildMetas,
+ buildSingleMeta,
+ META_KIND,
+ normalize,
+ normalizeAll,
+ normalizeParsed,
+ OPERAND_TYPES,
+ strip,
+} from './lib/metadata';
export { opcodeMetadata } from './lib/opcode-metadata';
-export * from './lib/stack-check';
+export {
+ check,
+ CheckArray,
+ CheckBlockSymbolTable,
+ CheckBoolean,
+ CheckDict,
+ CheckDocumentFragment,
+ CheckElement,
+ CheckFunction,
+ CheckHandle,
+ CheckInstanceof,
+ CheckInterface,
+ CheckMaybe,
+ CheckNode,
+ CheckNumber,
+ CheckObject,
+ CheckOption,
+ CheckOr,
+ CheckPrimitive,
+ CheckProgramSymbolTable,
+ CheckSafeString,
+ CheckString,
+ CheckUndefined,
+ CheckUnknown,
+ recordStackSize,
+ wrap,
+} from './lib/stack-check';
+
+// Types are optimized await automatically
+export type {
+ NormalizedMetadata,
+ NormalizedOpcodes,
+ Operand,
+ OperandList,
+ OperandName,
+ OperandType,
+ RawOperandFormat,
+ RawOperandMetadata,
+ Stack,
+} from './lib/metadata';
+export type { Checker } from './lib/stack-check';
diff --git a/packages/@glimmer/debug/lib/opcode-metadata.ts b/packages/@glimmer/debug/lib/opcode-metadata.ts
index c559bf57d3..a05c52d149 100644
--- a/packages/@glimmer/debug/lib/opcode-metadata.ts
+++ b/packages/@glimmer/debug/lib/opcode-metadata.ts
@@ -1,6 +1,7 @@
/* This file is generated by build/debug.js */
import type { Nullable, VmMachineOp, VmOp } from '@glimmer/interfaces';
+import { LOCAL_DEBUG } from '@glimmer/local-debug-flags';
import { MachineOp, Op } from '@glimmer/vm';
import type { NormalizedMetadata } from './metadata';
@@ -9,6 +10,10 @@ export function opcodeMetadata(
op: VmMachineOp | VmOp,
isMachine: 0 | 1
): Nullable {
+ if (!LOCAL_DEBUG) {
+ return null;
+ }
+
let value = isMachine ? MACHINE_METADATA[op] : METADATA[op];
return value || null;
@@ -16,1317 +21,1320 @@ export function opcodeMetadata(
const METADATA: Nullable[] = new Array(Op.Size).fill(null);
const MACHINE_METADATA: Nullable[] = new Array(Op.Size).fill(null);
-MACHINE_METADATA[MachineOp.PushFrame] = {
- name: 'PushFrame',
- mnemonic: 'pushf',
- before: null,
- stackChange: 2,
- ops: [],
- operands: 0,
- check: true,
-};
-
-MACHINE_METADATA[MachineOp.PopFrame] = {
- name: 'PopFrame',
- mnemonic: 'popf',
- before: null,
- stackChange: -2,
- ops: [],
- operands: 0,
- check: false,
-};
-
-MACHINE_METADATA[MachineOp.InvokeVirtual] = {
- name: 'InvokeVirtual',
- mnemonic: 'vcall',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-MACHINE_METADATA[MachineOp.InvokeStatic] = {
- name: 'InvokeStatic',
- mnemonic: 'scall',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'offset',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-MACHINE_METADATA[MachineOp.Jump] = {
- name: 'Jump',
- mnemonic: 'goto',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'to',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-MACHINE_METADATA[MachineOp.Return] = {
- name: 'Return',
- mnemonic: 'ret',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: false,
-};
-
-MACHINE_METADATA[MachineOp.ReturnTo] = {
- name: 'ReturnTo',
- mnemonic: 'setra',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'offset',
- type: 'i32',
- },
- ],
- operands: 1,
- check: true,
-};
-METADATA[Op.Helper] = {
- name: 'Helper',
- mnemonic: 'ncall',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'helper',
- type: 'handle',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.DynamicHelper] = {
- name: 'DynamicHelper',
- mnemonic: 'dynamiccall',
- before: null,
- stackChange: null,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.SetNamedVariables] = {
- name: 'SetNamedVariables',
- mnemonic: 'vsargs',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.SetBlocks] = {
- name: 'SetBlocks',
- mnemonic: 'vbblocks',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.SetVariable] = {
- name: 'SetVariable',
- mnemonic: 'sbvar',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'symbol',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.SetBlock] = {
- name: 'SetBlock',
- mnemonic: 'sblock',
- before: null,
- stackChange: -3,
- ops: [
- {
- name: 'symbol',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.GetVariable] = {
- name: 'GetVariable',
- mnemonic: 'symload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'symbol',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.GetProperty] = {
- name: 'GetProperty',
- mnemonic: 'getprop',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'property',
- type: 'str',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.GetBlock] = {
- name: 'GetBlock',
- mnemonic: 'blockload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'block',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.SpreadBlock] = {
- name: 'SpreadBlock',
- mnemonic: 'blockspread',
- before: null,
- stackChange: 2,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.HasBlock] = {
- name: 'HasBlock',
- mnemonic: 'hasblockload',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.HasBlockParams] = {
- name: 'HasBlockParams',
- mnemonic: 'hasparamsload',
- before: null,
- stackChange: -2,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Concat] = {
- name: 'Concat',
- mnemonic: 'concat',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'count',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.IfInline] = {
- name: 'IfInline',
- mnemonic: 'ifinline',
- before: null,
- stackChange: -2,
- ops: [
- {
- name: 'count',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Not] = {
- name: 'Not',
- mnemonic: 'not',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'count',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Constant] = {
- name: 'Constant',
- mnemonic: 'rconstload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'constant',
- type: 'unknown',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.ConstantReference] = {
- name: 'ConstantReference',
- mnemonic: 'rconstrefload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'constant',
- type: 'unknown',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Primitive] = {
- name: 'Primitive',
- mnemonic: 'pconstload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'constant',
- type: 'primitive',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PrimitiveReference] = {
- name: 'PrimitiveReference',
- mnemonic: 'ptoref',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.ReifyU32] = {
- name: 'ReifyU32',
- mnemonic: 'reifyload',
- before: null,
- stackChange: 1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Dup] = {
- name: 'Dup',
- mnemonic: 'dup',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- {
- name: 'offset',
- type: 'u32',
- },
- ],
- operands: 2,
- check: true,
-};
-
-METADATA[Op.Pop] = {
- name: 'Pop',
- mnemonic: 'pop',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'count',
- type: 'u32',
- },
- ],
- operands: 1,
- check: false,
-};
-
-METADATA[Op.Load] = {
- name: 'Load',
- mnemonic: 'put',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Fetch] = {
- name: 'Fetch',
- mnemonic: 'regload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.RootScope] = {
- name: 'RootScope',
- mnemonic: 'rscopepush',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'symbols',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.VirtualRootScope] = {
- name: 'VirtualRootScope',
- mnemonic: 'vrscopepush',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'register',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.ChildScope] = {
- name: 'ChildScope',
- mnemonic: 'cscopepush',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PopScope] = {
- name: 'PopScope',
- mnemonic: 'scopepop',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Text] = {
- name: 'Text',
- mnemonic: 'apnd_text',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'contents',
- type: 'str',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Comment] = {
- name: 'Comment',
- mnemonic: 'apnd_comment',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'contents',
- type: 'str',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.AppendHTML] = {
- name: 'AppendHTML',
- mnemonic: 'apnd_dynhtml',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.AppendSafeHTML] = {
- name: 'AppendSafeHTML',
- mnemonic: 'apnd_dynshtml',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.AppendDocumentFragment] = {
- name: 'AppendDocumentFragment',
- mnemonic: 'apnd_dynfrag',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.AppendNode] = {
- name: 'AppendNode',
- mnemonic: 'apnd_dynnode',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.AppendText] = {
- name: 'AppendText',
- mnemonic: 'apnd_dyntext',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.OpenElement] = {
- name: 'OpenElement',
- mnemonic: 'apnd_tag',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'tag',
- type: 'str',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.OpenDynamicElement] = {
- name: 'OpenDynamicElement',
- mnemonic: 'apnd_dyntag',
- before: null,
- stackChange: -1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PushRemoteElement] = {
- name: 'PushRemoteElement',
- mnemonic: 'apnd_remotetag',
- before: null,
- stackChange: -3,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.StaticAttr] = {
- name: 'StaticAttr',
- mnemonic: 'apnd_attr',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'name',
- type: 'str',
- },
- {
- name: 'value',
- type: 'str',
- },
- {
- name: 'namespace',
- type: 'option-str',
- },
- ],
- operands: 3,
- check: true,
-};
-
-METADATA[Op.DynamicAttr] = {
- name: 'DynamicAttr',
- mnemonic: 'apnd_dynattr',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'name',
- type: 'str',
- },
- {
- name: 'trusting',
- type: 'bool',
- },
- {
- name: 'namespace',
- type: 'option-str',
- },
- ],
- operands: 3,
- check: true,
-};
-
-METADATA[Op.ComponentAttr] = {
- name: 'ComponentAttr',
- mnemonic: 'apnd_cattr',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'name',
- type: 'str',
- },
- {
- name: 'trusting',
- type: 'bool',
- },
- {
- name: 'namespace',
- type: 'option-str',
- },
- ],
- operands: 3,
- check: true,
-};
-
-METADATA[Op.FlushElement] = {
- name: 'FlushElement',
- mnemonic: 'apnd_flushtag',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.CloseElement] = {
- name: 'CloseElement',
- mnemonic: 'apnd_closetag',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PopRemoteElement] = {
- name: 'PopRemoteElement',
- mnemonic: 'apnd_closeremotetag',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Modifier] = {
- name: 'Modifier',
- mnemonic: 'apnd_modifier',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'helper',
- type: 'handle',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.BindDynamicScope] = {
- name: 'BindDynamicScope',
- mnemonic: 'setdynscope',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'names',
- type: 'str-array',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PushDynamicScope] = {
- name: 'PushDynamicScope',
- mnemonic: 'dynscopepush',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PopDynamicScope] = {
- name: 'PopDynamicScope',
- mnemonic: 'dynscopepop',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.CompileBlock] = {
- name: 'CompileBlock',
- mnemonic: 'cmpblock',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PushBlockScope] = {
- name: 'PushBlockScope',
- mnemonic: 'scopeload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'scope',
- type: 'scope',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PushSymbolTable] = {
- name: 'PushSymbolTable',
- mnemonic: 'dsymload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'table',
- type: 'symbol-table',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.InvokeYield] = {
- name: 'InvokeYield',
- mnemonic: 'invokeyield',
- before: null,
- stackChange: null,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.JumpIf] = {
- name: 'JumpIf',
- mnemonic: 'iftrue',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'to',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.JumpUnless] = {
- name: 'JumpUnless',
- mnemonic: 'iffalse',
- before: null,
- stackChange: -1,
- ops: [
- {
- name: 'to',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.JumpEq] = {
- name: 'JumpEq',
- mnemonic: 'ifeq',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'to',
- type: 'i32',
- },
- {
- name: 'comparison',
- type: 'i32',
- },
- ],
- operands: 2,
- check: true,
-};
-
-METADATA[Op.AssertSame] = {
- name: 'AssertSame',
- mnemonic: 'assert_eq',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Enter] = {
- name: 'Enter',
- mnemonic: 'blk_start',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'args',
- type: 'u32',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Exit] = {
- name: 'Exit',
- mnemonic: 'blk_end',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.ToBoolean] = {
- name: 'ToBoolean',
- mnemonic: 'anytobool',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.EnterList] = {
- name: 'EnterList',
- mnemonic: 'list_start',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'address',
- type: 'u32',
- },
- {
- name: 'address',
- type: 'u32',
- },
- ],
- operands: 2,
- check: true,
-};
-
-METADATA[Op.ExitList] = {
- name: 'ExitList',
- mnemonic: 'list_end',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Iterate] = {
- name: 'Iterate',
- mnemonic: 'iter',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'end',
- type: 'u32',
- },
- ],
- operands: 1,
- check: false,
-};
-
-METADATA[Op.Main] = {
- name: 'Main',
- mnemonic: 'main',
- before: null,
- stackChange: -2,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.ContentType] = {
- name: 'ContentType',
- mnemonic: 'ctload',
- before: null,
- stackChange: 1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.DynamicContentType] = {
- name: 'DynamicContentType',
- mnemonic: 'dctload',
- before: null,
- stackChange: 1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.Curry] = {
- name: 'Curry',
- mnemonic: 'curry',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'type',
- type: 'u32',
- },
- {
- name: 'is-strict',
- type: 'bool',
- },
- ],
- operands: 2,
- check: true,
-};
-
-METADATA[Op.PushComponentDefinition] = {
- name: 'PushComponentDefinition',
- mnemonic: 'cmload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'spec',
- type: 'handle',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PushDynamicComponentInstance] = {
- name: 'PushDynamicComponentInstance',
- mnemonic: 'dciload',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.ResolveDynamicComponent] = {
- name: 'ResolveDynamicComponent',
- mnemonic: 'cdload',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'owner',
- type: 'owner',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PushArgs] = {
- name: 'PushArgs',
- mnemonic: 'argsload',
- before: null,
- stackChange: null,
- ops: [
- {
- name: 'names',
- type: 'str-array',
- },
- {
- name: 'block-names',
- type: 'str-array',
- },
- {
- name: 'flags',
- type: 'u32',
- },
- ],
- operands: 3,
- check: true,
-};
-
-METADATA[Op.PushEmptyArgs] = {
- name: 'PushEmptyArgs',
- mnemonic: 'emptyargsload',
- before: null,
- stackChange: 1,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PopArgs] = {
- name: 'PopArgs',
- mnemonic: 'argspop',
- before: null,
- stackChange: null,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.PrepareArgs] = {
- name: 'PrepareArgs',
- mnemonic: 'argsprep',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: false,
-};
-
-METADATA[Op.CaptureArgs] = {
- name: 'CaptureArgs',
- mnemonic: 'argscapture',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.CreateComponent] = {
- name: 'CreateComponent',
- mnemonic: 'comp_create',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'flags',
- type: 'u32',
- },
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 2,
- check: true,
-};
-
-METADATA[Op.RegisterComponentDestructor] = {
- name: 'RegisterComponentDestructor',
- mnemonic: 'comp_dest',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PutComponentOperations] = {
- name: 'PutComponentOperations',
- mnemonic: 'comp_elops',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.GetComponentSelf] = {
- name: 'GetComponentSelf',
- mnemonic: 'comp_selfload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.GetComponentTagName] = {
- name: 'GetComponentTagName',
- mnemonic: 'comp_tagload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.GetComponentLayout] = {
- name: 'GetComponentLayout',
- mnemonic: 'comp_layoutload',
- before: null,
- stackChange: 2,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.BindEvalScope] = {
- name: 'BindEvalScope',
- mnemonic: 'eval_scope',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.SetupForEval] = {
- name: 'SetupForEval',
- mnemonic: 'eval_setup',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.PopulateLayout] = {
- name: 'PopulateLayout',
- mnemonic: 'comp_layoutput',
- before: null,
- stackChange: -2,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.InvokeComponentLayout] = {
- name: 'InvokeComponentLayout',
- mnemonic: 'comp_invokelayout',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.BeginComponentTransaction] = {
- name: 'BeginComponentTransaction',
- mnemonic: 'comp_begin',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.CommitComponentTransaction] = {
- name: 'CommitComponentTransaction',
- mnemonic: 'comp_commit',
- before: null,
- stackChange: 0,
- ops: [],
- operands: 0,
- check: true,
-};
-
-METADATA[Op.DidCreateElement] = {
- name: 'DidCreateElement',
- mnemonic: 'comp_created',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.DidRenderLayout] = {
- name: 'DidRenderLayout',
- mnemonic: 'comp_rendered',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'state',
- type: 'register',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.ResolveMaybeLocal] = {
- name: 'ResolveMaybeLocal',
- mnemonic: 'eval_varload',
- before: null,
- stackChange: 1,
- ops: [
- {
- name: 'local',
- type: 'str',
- },
- ],
- operands: 1,
- check: true,
-};
-
-METADATA[Op.Debugger] = {
- name: 'Debugger',
- mnemonic: 'debugger',
- before: null,
- stackChange: 0,
- ops: [
- {
- name: 'symbols',
- type: 'str-array',
- },
- {
- name: 'debugInfo',
- type: 'array',
- },
- ],
- operands: 2,
- check: true,
-};
+
+if (LOCAL_DEBUG) {
+ MACHINE_METADATA[MachineOp.PushFrame] = {
+ name: 'PushFrame',
+ mnemonic: 'pushf',
+ before: null,
+ stackChange: 2,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ MACHINE_METADATA[MachineOp.PopFrame] = {
+ name: 'PopFrame',
+ mnemonic: 'popf',
+ before: null,
+ stackChange: -2,
+ ops: [],
+ operands: 0,
+ check: false,
+ };
+
+ MACHINE_METADATA[MachineOp.InvokeVirtual] = {
+ name: 'InvokeVirtual',
+ mnemonic: 'vcall',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ MACHINE_METADATA[MachineOp.InvokeStatic] = {
+ name: 'InvokeStatic',
+ mnemonic: 'scall',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'offset',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ MACHINE_METADATA[MachineOp.Jump] = {
+ name: 'Jump',
+ mnemonic: 'goto',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'to',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ MACHINE_METADATA[MachineOp.Return] = {
+ name: 'Return',
+ mnemonic: 'ret',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: false,
+ };
+
+ MACHINE_METADATA[MachineOp.ReturnTo] = {
+ name: 'ReturnTo',
+ mnemonic: 'setra',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'offset',
+ type: 'i32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+ METADATA[Op.Helper] = {
+ name: 'Helper',
+ mnemonic: 'ncall',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'helper',
+ type: 'handle',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.DynamicHelper] = {
+ name: 'DynamicHelper',
+ mnemonic: 'dynamiccall',
+ before: null,
+ stackChange: null,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.SetNamedVariables] = {
+ name: 'SetNamedVariables',
+ mnemonic: 'vsargs',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.SetBlocks] = {
+ name: 'SetBlocks',
+ mnemonic: 'vbblocks',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.SetVariable] = {
+ name: 'SetVariable',
+ mnemonic: 'sbvar',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'symbol',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.SetBlock] = {
+ name: 'SetBlock',
+ mnemonic: 'sblock',
+ before: null,
+ stackChange: -3,
+ ops: [
+ {
+ name: 'symbol',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.GetVariable] = {
+ name: 'GetVariable',
+ mnemonic: 'symload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'symbol',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.GetProperty] = {
+ name: 'GetProperty',
+ mnemonic: 'getprop',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'property',
+ type: 'str',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.GetBlock] = {
+ name: 'GetBlock',
+ mnemonic: 'blockload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'block',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.SpreadBlock] = {
+ name: 'SpreadBlock',
+ mnemonic: 'blockspread',
+ before: null,
+ stackChange: 2,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.HasBlock] = {
+ name: 'HasBlock',
+ mnemonic: 'hasblockload',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.HasBlockParams] = {
+ name: 'HasBlockParams',
+ mnemonic: 'hasparamsload',
+ before: null,
+ stackChange: -2,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Concat] = {
+ name: 'Concat',
+ mnemonic: 'concat',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'count',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.IfInline] = {
+ name: 'IfInline',
+ mnemonic: 'ifinline',
+ before: null,
+ stackChange: -2,
+ ops: [
+ {
+ name: 'count',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Not] = {
+ name: 'Not',
+ mnemonic: 'not',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'count',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Constant] = {
+ name: 'Constant',
+ mnemonic: 'rconstload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'constant',
+ type: 'unknown',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.ConstantReference] = {
+ name: 'ConstantReference',
+ mnemonic: 'rconstrefload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'constant',
+ type: 'unknown',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Primitive] = {
+ name: 'Primitive',
+ mnemonic: 'pconstload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'constant',
+ type: 'primitive',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PrimitiveReference] = {
+ name: 'PrimitiveReference',
+ mnemonic: 'ptoref',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.ReifyU32] = {
+ name: 'ReifyU32',
+ mnemonic: 'reifyload',
+ before: null,
+ stackChange: 1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Dup] = {
+ name: 'Dup',
+ mnemonic: 'dup',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ {
+ name: 'offset',
+ type: 'u32',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+
+ METADATA[Op.Pop] = {
+ name: 'Pop',
+ mnemonic: 'pop',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'count',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: false,
+ };
+
+ METADATA[Op.Load] = {
+ name: 'Load',
+ mnemonic: 'put',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Fetch] = {
+ name: 'Fetch',
+ mnemonic: 'regload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.RootScope] = {
+ name: 'RootScope',
+ mnemonic: 'rscopepush',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'symbols',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.VirtualRootScope] = {
+ name: 'VirtualRootScope',
+ mnemonic: 'vrscopepush',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'register',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.ChildScope] = {
+ name: 'ChildScope',
+ mnemonic: 'cscopepush',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PopScope] = {
+ name: 'PopScope',
+ mnemonic: 'scopepop',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Text] = {
+ name: 'Text',
+ mnemonic: 'apnd_text',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'contents',
+ type: 'str',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Comment] = {
+ name: 'Comment',
+ mnemonic: 'apnd_comment',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'contents',
+ type: 'str',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.AppendHTML] = {
+ name: 'AppendHTML',
+ mnemonic: 'apnd_dynhtml',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.AppendSafeHTML] = {
+ name: 'AppendSafeHTML',
+ mnemonic: 'apnd_dynshtml',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.AppendDocumentFragment] = {
+ name: 'AppendDocumentFragment',
+ mnemonic: 'apnd_dynfrag',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.AppendNode] = {
+ name: 'AppendNode',
+ mnemonic: 'apnd_dynnode',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.AppendText] = {
+ name: 'AppendText',
+ mnemonic: 'apnd_dyntext',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.OpenElement] = {
+ name: 'OpenElement',
+ mnemonic: 'apnd_tag',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'tag',
+ type: 'str',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.OpenDynamicElement] = {
+ name: 'OpenDynamicElement',
+ mnemonic: 'apnd_dyntag',
+ before: null,
+ stackChange: -1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PushRemoteElement] = {
+ name: 'PushRemoteElement',
+ mnemonic: 'apnd_remotetag',
+ before: null,
+ stackChange: -3,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.StaticAttr] = {
+ name: 'StaticAttr',
+ mnemonic: 'apnd_attr',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'name',
+ type: 'str',
+ },
+ {
+ name: 'value',
+ type: 'str',
+ },
+ {
+ name: 'namespace',
+ type: 'option-str',
+ },
+ ],
+ operands: 3,
+ check: true,
+ };
+
+ METADATA[Op.DynamicAttr] = {
+ name: 'DynamicAttr',
+ mnemonic: 'apnd_dynattr',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'name',
+ type: 'str',
+ },
+ {
+ name: 'trusting',
+ type: 'bool',
+ },
+ {
+ name: 'namespace',
+ type: 'option-str',
+ },
+ ],
+ operands: 3,
+ check: true,
+ };
+
+ METADATA[Op.ComponentAttr] = {
+ name: 'ComponentAttr',
+ mnemonic: 'apnd_cattr',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'name',
+ type: 'str',
+ },
+ {
+ name: 'trusting',
+ type: 'bool',
+ },
+ {
+ name: 'namespace',
+ type: 'option-str',
+ },
+ ],
+ operands: 3,
+ check: true,
+ };
+
+ METADATA[Op.FlushElement] = {
+ name: 'FlushElement',
+ mnemonic: 'apnd_flushtag',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.CloseElement] = {
+ name: 'CloseElement',
+ mnemonic: 'apnd_closetag',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PopRemoteElement] = {
+ name: 'PopRemoteElement',
+ mnemonic: 'apnd_closeremotetag',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Modifier] = {
+ name: 'Modifier',
+ mnemonic: 'apnd_modifier',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'helper',
+ type: 'handle',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.BindDynamicScope] = {
+ name: 'BindDynamicScope',
+ mnemonic: 'setdynscope',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'names',
+ type: 'str-array',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PushDynamicScope] = {
+ name: 'PushDynamicScope',
+ mnemonic: 'dynscopepush',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PopDynamicScope] = {
+ name: 'PopDynamicScope',
+ mnemonic: 'dynscopepop',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.CompileBlock] = {
+ name: 'CompileBlock',
+ mnemonic: 'cmpblock',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PushBlockScope] = {
+ name: 'PushBlockScope',
+ mnemonic: 'scopeload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'scope',
+ type: 'scope',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PushSymbolTable] = {
+ name: 'PushSymbolTable',
+ mnemonic: 'dsymload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'table',
+ type: 'symbol-table',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.InvokeYield] = {
+ name: 'InvokeYield',
+ mnemonic: 'invokeyield',
+ before: null,
+ stackChange: null,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.JumpIf] = {
+ name: 'JumpIf',
+ mnemonic: 'iftrue',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'to',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.JumpUnless] = {
+ name: 'JumpUnless',
+ mnemonic: 'iffalse',
+ before: null,
+ stackChange: -1,
+ ops: [
+ {
+ name: 'to',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.JumpEq] = {
+ name: 'JumpEq',
+ mnemonic: 'ifeq',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'to',
+ type: 'i32',
+ },
+ {
+ name: 'comparison',
+ type: 'i32',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+
+ METADATA[Op.AssertSame] = {
+ name: 'AssertSame',
+ mnemonic: 'assert_eq',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Enter] = {
+ name: 'Enter',
+ mnemonic: 'blk_start',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'args',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Exit] = {
+ name: 'Exit',
+ mnemonic: 'blk_end',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.ToBoolean] = {
+ name: 'ToBoolean',
+ mnemonic: 'anytobool',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.EnterList] = {
+ name: 'EnterList',
+ mnemonic: 'list_start',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'address',
+ type: 'u32',
+ },
+ {
+ name: 'address',
+ type: 'u32',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+
+ METADATA[Op.ExitList] = {
+ name: 'ExitList',
+ mnemonic: 'list_end',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Iterate] = {
+ name: 'Iterate',
+ mnemonic: 'iter',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'end',
+ type: 'u32',
+ },
+ ],
+ operands: 1,
+ check: false,
+ };
+
+ METADATA[Op.Main] = {
+ name: 'Main',
+ mnemonic: 'main',
+ before: null,
+ stackChange: -2,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.ContentType] = {
+ name: 'ContentType',
+ mnemonic: 'ctload',
+ before: null,
+ stackChange: 1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.DynamicContentType] = {
+ name: 'DynamicContentType',
+ mnemonic: 'dctload',
+ before: null,
+ stackChange: 1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.Curry] = {
+ name: 'Curry',
+ mnemonic: 'curry',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'type',
+ type: 'u32',
+ },
+ {
+ name: 'is-strict',
+ type: 'bool',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+
+ METADATA[Op.PushComponentDefinition] = {
+ name: 'PushComponentDefinition',
+ mnemonic: 'cmload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'spec',
+ type: 'handle',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PushDynamicComponentInstance] = {
+ name: 'PushDynamicComponentInstance',
+ mnemonic: 'dciload',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.ResolveDynamicComponent] = {
+ name: 'ResolveDynamicComponent',
+ mnemonic: 'cdload',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'owner',
+ type: 'owner',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PushArgs] = {
+ name: 'PushArgs',
+ mnemonic: 'argsload',
+ before: null,
+ stackChange: null,
+ ops: [
+ {
+ name: 'names',
+ type: 'str-array',
+ },
+ {
+ name: 'block-names',
+ type: 'str-array',
+ },
+ {
+ name: 'flags',
+ type: 'u32',
+ },
+ ],
+ operands: 3,
+ check: true,
+ };
+
+ METADATA[Op.PushEmptyArgs] = {
+ name: 'PushEmptyArgs',
+ mnemonic: 'emptyargsload',
+ before: null,
+ stackChange: 1,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PopArgs] = {
+ name: 'PopArgs',
+ mnemonic: 'argspop',
+ before: null,
+ stackChange: null,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.PrepareArgs] = {
+ name: 'PrepareArgs',
+ mnemonic: 'argsprep',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: false,
+ };
+
+ METADATA[Op.CaptureArgs] = {
+ name: 'CaptureArgs',
+ mnemonic: 'argscapture',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.CreateComponent] = {
+ name: 'CreateComponent',
+ mnemonic: 'comp_create',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'flags',
+ type: 'u32',
+ },
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+
+ METADATA[Op.RegisterComponentDestructor] = {
+ name: 'RegisterComponentDestructor',
+ mnemonic: 'comp_dest',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PutComponentOperations] = {
+ name: 'PutComponentOperations',
+ mnemonic: 'comp_elops',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.GetComponentSelf] = {
+ name: 'GetComponentSelf',
+ mnemonic: 'comp_selfload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.GetComponentTagName] = {
+ name: 'GetComponentTagName',
+ mnemonic: 'comp_tagload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.GetComponentLayout] = {
+ name: 'GetComponentLayout',
+ mnemonic: 'comp_layoutload',
+ before: null,
+ stackChange: 2,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.BindEvalScope] = {
+ name: 'BindEvalScope',
+ mnemonic: 'eval_scope',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.SetupForEval] = {
+ name: 'SetupForEval',
+ mnemonic: 'eval_setup',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.PopulateLayout] = {
+ name: 'PopulateLayout',
+ mnemonic: 'comp_layoutput',
+ before: null,
+ stackChange: -2,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.InvokeComponentLayout] = {
+ name: 'InvokeComponentLayout',
+ mnemonic: 'comp_invokelayout',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.BeginComponentTransaction] = {
+ name: 'BeginComponentTransaction',
+ mnemonic: 'comp_begin',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.CommitComponentTransaction] = {
+ name: 'CommitComponentTransaction',
+ mnemonic: 'comp_commit',
+ before: null,
+ stackChange: 0,
+ ops: [],
+ operands: 0,
+ check: true,
+ };
+
+ METADATA[Op.DidCreateElement] = {
+ name: 'DidCreateElement',
+ mnemonic: 'comp_created',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.DidRenderLayout] = {
+ name: 'DidRenderLayout',
+ mnemonic: 'comp_rendered',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'state',
+ type: 'register',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.ResolveMaybeLocal] = {
+ name: 'ResolveMaybeLocal',
+ mnemonic: 'eval_varload',
+ before: null,
+ stackChange: 1,
+ ops: [
+ {
+ name: 'local',
+ type: 'str',
+ },
+ ],
+ operands: 1,
+ check: true,
+ };
+
+ METADATA[Op.Debugger] = {
+ name: 'Debugger',
+ mnemonic: 'debugger',
+ before: null,
+ stackChange: 0,
+ ops: [
+ {
+ name: 'symbols',
+ type: 'str-array',
+ },
+ {
+ name: 'debugInfo',
+ type: 'array',
+ },
+ ],
+ operands: 2,
+ check: true,
+ };
+}
diff --git a/packages/@glimmer/debug/lib/stack-check.ts b/packages/@glimmer/debug/lib/stack-check.ts
index f8abf5bbba..a0b81969a3 100644
--- a/packages/@glimmer/debug/lib/stack-check.ts
+++ b/packages/@glimmer/debug/lib/stack-check.ts
@@ -8,6 +8,7 @@ import type {
SimpleElement,
SimpleNode,
} from '@glimmer/interfaces';
+import { LOCAL_DEBUG } from '@glimmer/local-debug-flags';
export interface Checker {
type: T;
@@ -16,7 +17,21 @@ export interface Checker {
expected(): string;
}
+class NoopChecker implements Checker {
+ declare type: T;
+ validate(value: unknown): value is T {
+ return true;
+ }
+ expected(): string {
+ return '';
+ }
+}
+
export function wrap(checker: () => Checker): Checker {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
+
class Wrapped {
declare type: T;
@@ -285,14 +300,26 @@ class SafeStringChecker implements Checker {
}
export function CheckInstanceof(Class: Constructor): Checker {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
+
return new InstanceofChecker(Class);
}
export function CheckOption(checker: Checker): Checker> {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
+
return new OptionChecker(checker, null);
}
export function CheckMaybe(checker: Checker): Checker> {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
+
return new MaybeChecker(checker);
}
@@ -300,14 +327,24 @@ export function CheckInterface<
I extends { [P in keyof O]: O[P]['type'] },
O extends Dict>,
>(obj: O): Checker {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
+
return new PropertyChecker(obj);
}
export function CheckArray(obj: Checker): Checker {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
return new ArrayChecker(obj);
}
export function CheckDict(obj: Checker): Checker> {
+ if (!LOCAL_DEBUG) {
+ return new NoopChecker();
+ }
return new DictChecker(obj);
}
@@ -326,6 +363,10 @@ export function check(
checker: Checker | ((value: unknown) => void),
message: (value: unknown, expected: string) => string = defaultMessage
): T {
+ if (!LOCAL_DEBUG) {
+ return value as T;
+ }
+
if (typeof checker === 'function') {
checker(value);
return value as T;
@@ -344,6 +385,10 @@ export function recordStackSize(sp: number) {
}
export function expectStackChange(stack: { sp: number }, expected: number, name: string) {
+ if (LOCAL_DEBUG) {
+ return;
+ }
+
let actual = stack.sp - size;
if (actual === expected) return;
@@ -353,47 +398,79 @@ export function expectStackChange(stack: { sp: number }, expected: number, name:
);
}
-export const CheckPrimitive: Checker = new PrimitiveChecker();
-export const CheckFunction: Checker = new TypeofChecker('function');
-export const CheckNumber: Checker = new TypeofChecker('number');
-export const CheckBoolean: Checker = new TypeofChecker('boolean');
-export const CheckHandle: Checker = CheckNumber;
-export const CheckString: Checker = new TypeofChecker('string');
-export const CheckNull: Checker = new NullChecker();
-export const CheckUndefined: Checker = new UndefinedChecker();
-export const CheckUnknown: Checker = new OpaqueChecker();
-export const CheckSafeString: Checker = new SafeStringChecker();
-export const CheckObject: Checker