Skip to content

Commit 9467509

Browse files
authored
Merge pull request #1662 from glimmerjs/cleanup/remove-eval-names
Remove Partial infra and rename eval -> debugger
2 parents c8c1d91 + 01417b4 commit 9467509

File tree

13 files changed

+52
-76
lines changed

13 files changed

+52
-76
lines changed

bin/opcodes.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"GetComponentSelf",
9292
"GetComponentTagName",
9393
"GetComponentLayout",
94-
"SetupForEval",
94+
"SetupForDebug",
9595
"PopulateLayout",
9696
"InvokeComponentLayout",
9797
"BeginComponentTransaction",

packages/@glimmer/constants/lib/syscall-ops.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import type {
66
VmAppendText,
77
VmAssertSame,
88
VmBeginComponentTransaction,
9+
VmBindDebuggerScope,
910
VmBindDynamicScope,
10-
VmBindEvalScope,
1111
VmCaptureArgs,
1212
VmChildScope,
1313
VmCloseElement,
@@ -86,7 +86,7 @@ import type {
8686
VmSetBlock,
8787
VmSetBlocks,
8888
VmSetNamedVariables,
89-
VmSetupForEval,
89+
VmSetupForDebugger,
9090
VmSetVariable,
9191
VmSize,
9292
VmSpreadBlock,
@@ -174,8 +174,8 @@ export const VM_PUT_COMPONENT_OPERATIONS_OP = 89 satisfies VmPutComponentOperati
174174
export const VM_GET_COMPONENT_SELF_OP = 90 satisfies VmGetComponentSelf;
175175
export const VM_GET_COMPONENT_TAG_NAME_OP = 91 satisfies VmGetComponentTagName;
176176
export const VM_GET_COMPONENT_LAYOUT_OP = 92 satisfies VmGetComponentLayout;
177-
export const VM_BIND_EVAL_SCOPE_OP = 93 satisfies VmBindEvalScope;
178-
export const VM_SETUP_FOR_EVAL_OP = 94 satisfies VmSetupForEval;
177+
export const VM_BIND_DEBUGGER_SCOPE_OP = 93 satisfies VmBindDebuggerScope;
178+
export const VM_SETUP_FOR_DEBUGGER_OP = 94 satisfies VmSetupForDebugger;
179179
export const VM_POPULATE_LAYOUT_OP = 95 satisfies VmPopulateLayout;
180180
export const VM_INVOKE_COMPONENT_LAYOUT_OP = 96 satisfies VmInvokeComponentLayout;
181181
export const VM_BEGIN_COMPONENT_TRANSACTION_OP = 97 satisfies VmBeginComponentTransaction;

packages/@glimmer/debug/lib/opcode-metadata.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
VM_APPEND_TEXT_OP,
1010
VM_ASSERT_SAME_OP,
1111
VM_BEGIN_COMPONENT_TRANSACTION_OP,
12+
VM_BIND_DEBUGGER_SCOPE_OP,
1213
VM_BIND_DYNAMIC_SCOPE_OP,
13-
VM_BIND_EVAL_SCOPE_OP,
1414
VM_CAPTURE_ARGS_OP,
1515
VM_CHILD_SCOPE_OP,
1616
VM_CLOSE_ELEMENT_OP,
@@ -93,7 +93,7 @@ import {
9393
VM_SET_BLOCKS_OP,
9494
VM_SET_NAMED_VARIABLES_OP,
9595
VM_SET_VARIABLE_OP,
96-
VM_SETUP_FOR_EVAL_OP,
96+
VM_SETUP_FOR_DEBUGGER_OP,
9797
VM_SPREAD_BLOCK_OP,
9898
VM_STATIC_ATTR_OP,
9999
VM_SYSCALL_SIZE,
@@ -1293,9 +1293,9 @@ if (LOCAL_DEBUG) {
12931293
check: true,
12941294
};
12951295

1296-
METADATA[VM_BIND_EVAL_SCOPE_OP] = {
1297-
name: 'BindEvalScope',
1298-
mnemonic: 'eval_scope',
1296+
METADATA[VM_BIND_DEBUGGER_SCOPE_OP] = {
1297+
name: 'BindDebuggerScope',
1298+
mnemonic: 'debugger_scope',
12991299
before: null,
13001300
stackChange: 0,
13011301
ops: [
@@ -1308,9 +1308,9 @@ if (LOCAL_DEBUG) {
13081308
check: true,
13091309
};
13101310

1311-
METADATA[VM_SETUP_FOR_EVAL_OP] = {
1312-
name: 'SetupForEval',
1313-
mnemonic: 'eval_setup',
1311+
METADATA[VM_SETUP_FOR_DEBUGGER_OP] = {
1312+
name: 'SetupForDebugger',
1313+
mnemonic: 'debugger_setup',
13141314
before: null,
13151315
stackChange: 0,
13161316
ops: [

packages/@glimmer/interfaces/lib/runtime/scope.d.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@ export interface Scope {
1818
getSelf(): Reference;
1919
getSymbol(symbol: number): Reference;
2020
getBlock(symbol: number): Nullable<ScopeBlock>;
21-
getEvalScope(): Nullable<Dict<ScopeSlot>>;
22-
getPartialMap(): Nullable<Dict<Reference>>;
21+
getDebuggerScope(): Nullable<Dict<ScopeSlot>>;
2322
bind(symbol: number, value: ScopeSlot): void;
2423
bindSelf(self: Reference): void;
2524
bindSymbol(symbol: number, value: Reference): void;
2625
bindBlock(symbol: number, value: Nullable<ScopeBlock>): void;
27-
bindEvalScope(map: Nullable<Dict<ScopeSlot>>): void;
28-
bindPartialMap(map: Dict<Reference>): void;
26+
bindDebuggerScope(map: Nullable<Dict<ScopeSlot>>): void;
2927
child(): Scope;
3028
}
3129

32-
export interface PartialScope extends Scope {
33-
bindEvalScope(scope: Nullable<Dict<ScopeSlot>>): void;
34-
}
35-
3630
export interface DynamicScope {
3731
get(key: string): Reference<unknown>;
3832
set(key: string, reference: Reference<unknown>): Reference<unknown>;

packages/@glimmer/interfaces/lib/vm-opcodes.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export type VmPutComponentOperations = 89;
9696
export type VmGetComponentSelf = 90;
9797
export type VmGetComponentTagName = 91;
9898
export type VmGetComponentLayout = 92;
99-
export type VmBindEvalScope = 93;
100-
export type VmSetupForEval = 94;
99+
export type VmBindDebuggerScope = 93;
100+
export type VmSetupForDebugger = 94;
101101
export type VmPopulateLayout = 95;
102102
export type VmInvokeComponentLayout = 96;
103103
export type VmBeginComponentTransaction = 97;
@@ -193,8 +193,8 @@ export type VmOp =
193193
| VmGetComponentSelf
194194
| VmGetComponentTagName
195195
| VmGetComponentLayout
196-
| VmBindEvalScope
197-
| VmSetupForEval
196+
| VmBindDebuggerScope
197+
| VmSetupForDebugger
198198
| VmPopulateLayout
199199
| VmInvokeComponentLayout
200200
| VmBeginComponentTransaction

packages/@glimmer/opcode-compiler/lib/opcode-builder/helpers/components.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
VM_SET_BLOCKS_OP,
5252
VM_SET_NAMED_VARIABLES_OP,
5353
VM_SET_VARIABLE_OP,
54-
VM_SETUP_FOR_EVAL_OP,
54+
VM_SETUP_FOR_DEBUGGER_OP,
5555
VM_VIRTUAL_ROOT_SCOPE_OP,
5656
} from '@glimmer/constants';
5757
import { unwrap } from '@glimmer/debug-util';
@@ -463,7 +463,7 @@ export function invokePreparedComponent(
463463

464464
op(VM_VIRTUAL_ROOT_SCOPE_OP, $s0);
465465
op(VM_SET_VARIABLE_OP, 0);
466-
op(VM_SETUP_FOR_EVAL_OP, $s0);
466+
op(VM_SETUP_FOR_DEBUGGER_OP, $s0);
467467

468468
if (bindableAtNames) op(VM_SET_NAMED_VARIABLES_OP, $s0);
469469
if (bindableBlocks) op(VM_SET_BLOCKS_OP, $s0);

packages/@glimmer/runtime/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export { hash } from './lib/helpers/hash';
3939
export { invokeHelper } from './lib/helpers/invoke';
4040
export { on } from './lib/modifiers/on';
4141
export { renderComponent, renderMain, renderSync } from './lib/render';
42-
export { DynamicScopeImpl, PartialScopeImpl } from './lib/scope';
42+
export { DynamicScopeImpl, ScopeImpl } from './lib/scope';
4343
export type { SafeString } from './lib/upsert';
4444
export { UpdatingVM, type VM } from './lib/vm';
4545
export {

packages/@glimmer/runtime/lib/compiled/opcodes/-debug-strip.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
import { REFERENCE, UNDEFINED_REFERENCE } from '@glimmer/reference';
3737
import { COMPUTE } from '@glimmer/validator';
3838

39-
import { PartialScopeImpl } from '../../scope';
39+
import { ScopeImpl } from '../../scope';
4040
import { VMArgumentsImpl } from '../../vm/arguments';
4141
import { ComponentElementOperations } from './component';
4242

@@ -92,7 +92,7 @@ export const CheckCapturedArguments: Checker<CapturedArguments> = CheckInterface
9292
named: wrap(() => CheckDict(CheckReference)),
9393
});
9494

95-
export const CheckScope: Checker<Scope> = wrap(() => CheckInstanceof(PartialScopeImpl));
95+
export const CheckScope: Checker<Scope> = wrap(() => CheckInstanceof(ScopeImpl));
9696

9797
export const CheckComponentManager: Checker<InternalComponentManager<unknown>> = CheckInterface({
9898
getCapabilities: CheckFunction,

packages/@glimmer/runtime/lib/compiled/opcodes/component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {
5050
VM_RESOLVE_DYNAMIC_COMPONENT_OP,
5151
VM_SET_BLOCKS_OP,
5252
VM_SET_NAMED_VARIABLES_OP,
53-
VM_SETUP_FOR_EVAL_OP,
53+
VM_SETUP_FOR_DEBUGGER_OP,
5454
VM_STATIC_COMPONENT_ATTR_OP,
5555
VM_VIRTUAL_ROOT_SCOPE_OP,
5656
} from '@glimmer/constants';
@@ -838,12 +838,12 @@ APPEND_OPCODES.add(VM_VIRTUAL_ROOT_SCOPE_OP, (vm, { op1: register }) => {
838838
vm.pushRootScope(table.symbols.length + 1, owner);
839839
});
840840

841-
APPEND_OPCODES.add(VM_SETUP_FOR_EVAL_OP, (vm, { op1: register }) => {
841+
APPEND_OPCODES.add(VM_SETUP_FOR_DEBUGGER_OP, (vm, { op1: register }) => {
842842
let state = check(vm.fetchValue(check(register, CheckRegister)), CheckFinishedComponentInstance);
843843

844844
if (state.table.hasEval) {
845845
let lookup = (state.lookup = dict<ScopeSlot>());
846-
vm.scope().bindEvalScope(lookup);
846+
vm.scope().bindDebuggerScope(lookup);
847847
}
848848
});
849849

packages/@glimmer/runtime/lib/compiled/opcodes/debugger.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ class ScopeInspector {
5353
let parts = path.split('.');
5454
let [head, ...tail] = path.split('.') as [string, ...string[]];
5555

56-
let evalScope = scope.getEvalScope()!;
56+
let debuggerScope = scope.getDebuggerScope()!;
5757
let ref: Reference;
5858

5959
if (head === 'this') {
6060
ref = scope.getSelf();
6161
} else if (locals[head]) {
6262
ref = unwrap(locals[head]);
63-
} else if (head.indexOf('@') === 0 && evalScope[head]) {
64-
ref = evalScope[head] as Reference;
63+
} else if (head.indexOf('@') === 0 && debuggerScope[head]) {
64+
ref = debuggerScope[head] as Reference;
6565
} else {
6666
ref = this.scope.getSelf();
6767
tail = parts;

packages/@glimmer/runtime/lib/scope.ts

+11-28
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {
33
DynamicScope,
44
Nullable,
55
Owner,
6-
PartialScope,
76
Scope,
87
ScopeBlock,
98
ScopeSlot,
@@ -42,28 +41,26 @@ export function isScopeReference(s: ScopeSlot): s is Reference {
4241
return true;
4342
}
4443

45-
export class PartialScopeImpl implements PartialScope {
46-
static root(self: Reference<unknown>, size = 0, owner: Owner): PartialScope {
44+
export class ScopeImpl implements Scope {
45+
static root(self: Reference<unknown>, size = 0, owner: Owner): Scope {
4746
let refs: Reference<unknown>[] = new Array(size + 1).fill(UNDEFINED_REFERENCE);
4847

49-
return new PartialScopeImpl(refs, owner, null, null, null).init({ self });
48+
return new ScopeImpl(refs, owner, null, null).init({ self });
5049
}
5150

5251
static sized(size = 0, owner: Owner): Scope {
5352
let refs: Reference<unknown>[] = new Array(size + 1).fill(UNDEFINED_REFERENCE);
5453

55-
return new PartialScopeImpl(refs, owner, null, null, null);
54+
return new ScopeImpl(refs, owner, null, null);
5655
}
5756

5857
constructor(
5958
// the 0th slot is `self`
6059
readonly slots: Array<ScopeSlot>,
6160
readonly owner: Owner,
6261
private callerScope: Scope | null,
63-
// named arguments and blocks passed to a layout that uses eval
64-
private evalScope: Dict<ScopeSlot> | null,
65-
// locals in scope when the partial was invoked
66-
private partialMap: Dict<Reference<unknown>> | null
62+
// named arguments and blocks passed to a layout that uses debugger
63+
private debuggerScope: Dict<ScopeSlot> | null
6764
) {}
6865

6966
init({ self }: { self: Reference<unknown> }): this {
@@ -84,12 +81,8 @@ export class PartialScopeImpl implements PartialScope {
8481
return block === UNDEFINED_REFERENCE ? null : (block as ScopeBlock);
8582
}
8683

87-
getEvalScope(): Nullable<Dict<ScopeSlot>> {
88-
return this.evalScope;
89-
}
90-
91-
getPartialMap(): Nullable<Dict<Reference<unknown>>> {
92-
return this.partialMap;
84+
getDebuggerScope(): Nullable<Dict<ScopeSlot>> {
85+
return this.debuggerScope;
9386
}
9487

9588
bind(symbol: number, value: ScopeSlot) {
@@ -108,12 +101,8 @@ export class PartialScopeImpl implements PartialScope {
108101
this.set<Nullable<ScopeBlock>>(symbol, value);
109102
}
110103

111-
bindEvalScope(map: Nullable<Dict<ScopeSlot>>) {
112-
this.evalScope = map;
113-
}
114-
115-
bindPartialMap(map: Dict<Reference<unknown>>) {
116-
this.partialMap = map;
104+
bindDebuggerScope(map: Nullable<Dict<ScopeSlot>>) {
105+
this.debuggerScope = map;
117106
}
118107

119108
bindCallerScope(scope: Nullable<Scope>): void {
@@ -125,13 +114,7 @@ export class PartialScopeImpl implements PartialScope {
125114
}
126115

127116
child(): Scope {
128-
return new PartialScopeImpl(
129-
this.slots.slice(),
130-
this.owner,
131-
this.callerScope,
132-
this.evalScope,
133-
this.partialMap
134-
);
117+
return new ScopeImpl(this.slots.slice(), this.owner, this.callerScope, this.debuggerScope);
135118
}
136119

137120
private get<T extends ScopeSlot>(index: number): T {

packages/@glimmer/runtime/lib/vm/append.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
JitConstants,
99
Nullable,
1010
Owner,
11-
PartialScope,
1211
RenderResult,
1312
RichIteratorResult,
1413
RuntimeContext,
@@ -53,7 +52,7 @@ import {
5352
JumpIfNotModifiedOpcode,
5453
} from '../compiled/opcodes/vm';
5554
import { APPEND_OPCODES } from '../opcodes';
56-
import { PartialScopeImpl } from '../scope';
55+
import { ScopeImpl } from '../scope';
5756
import { VMArgumentsImpl } from './arguments';
5857
import { LowLevelVM } from './low-level';
5958
import RenderResultImpl from './render-result';
@@ -240,7 +239,7 @@ export class VM implements PublicVM {
240239
context: CompileTimeCompilationContext,
241240
{ handle, self, dynamicScope, treeBuilder, numSymbols, owner }: InitOptions
242241
) {
243-
let scope = PartialScopeImpl.root(self, numSymbols, owner);
242+
let scope = ScopeImpl.root(self, numSymbols, owner);
244243
let state = vmState(runtime.program.heap.getaddr(handle), scope, dynamicScope);
245244
let vm = initVM(context)(runtime, state, treeBuilder);
246245
vm.pushUpdating();
@@ -256,7 +255,7 @@ export class VM implements PublicVM {
256255
runtime,
257256
vmState(
258257
runtime.program.heap.getaddr(handle),
259-
PartialScopeImpl.root(UNDEFINED_REFERENCE, 0, owner),
258+
ScopeImpl.root(UNDEFINED_REFERENCE, 0, owner),
260259
dynamicScope
261260
),
262261
treeBuilder
@@ -437,8 +436,8 @@ export class VM implements PublicVM {
437436
return child;
438437
}
439438

440-
pushRootScope(size: number, owner: Owner): PartialScope {
441-
let scope = PartialScopeImpl.sized(size, owner);
439+
pushRootScope(size: number, owner: Owner): Scope {
440+
let scope = ScopeImpl.sized(size, owner);
442441
this.#stacks.scope.push(scope);
443442
return scope;
444443
}

packages/@glimmer/vm/lib/opcodes.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,15 @@ format = ["GetComponentLayout", "state:register"]
666666
operand-stack = [[], ["ProgramSymbolTable", "handle"]]
667667
operation = "Get the component layout from the manager."
668668

669-
[syscall.eval_scope]
669+
[syscall.debugger_scope]
670670

671-
format = ["BindEvalScope", "state:register"]
672-
operation = "Populate the eval lookup if necessary."
671+
format = ["BindDebuggerScope", "state:register"]
672+
operation = "Populate the debugger lookup if necessary."
673673

674-
[syscall.eval_setup]
674+
[syscall.debugger_setup]
675675

676-
format = ["SetupForEval", "state:register"]
677-
operation = "Setup for eval"
676+
format = ["SetupForDebugger", "state:register"]
677+
operation = "Setup for debugger"
678678

679679
[syscall.comp_layoutput]
680680

0 commit comments

Comments
 (0)