@quenk/potoo 4.0.12 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/lib/actor/address.d.ts +5 -1
  2. package/lib/actor/address.js +7 -2
  3. package/lib/actor/address.js.map +1 -1
  4. package/lib/actor/system/vm/allocator/index.d.ts +9 -2
  5. package/lib/actor/system/vm/allocator/map.d.ts +2 -1
  6. package/lib/actor/system/vm/allocator/map.js +30 -23
  7. package/lib/actor/system/vm/allocator/map.js.map +1 -1
  8. package/lib/actor/system/vm/event/dispatcher.d.ts +4 -4
  9. package/lib/actor/system/vm/event/dispatcher.js +9 -9
  10. package/lib/actor/system/vm/event/dispatcher.js.map +1 -1
  11. package/lib/actor/system/vm/event/index.d.ts +1 -1
  12. package/lib/actor/system/vm/event/index.js +1 -1
  13. package/lib/actor/system/vm/index.d.ts +16 -9
  14. package/lib/actor/system/vm/index.js +17 -9
  15. package/lib/actor/system/vm/index.js.map +1 -1
  16. package/lib/actor/system/vm/runtime/error.d.ts +0 -42
  17. package/lib/actor/system/vm/runtime/error.js +1 -61
  18. package/lib/actor/system/vm/runtime/error.js.map +1 -1
  19. package/lib/actor/system/vm/thread/collector.d.ts +35 -0
  20. package/lib/actor/system/vm/thread/collector.js +52 -0
  21. package/lib/actor/system/vm/thread/collector.js.map +1 -0
  22. package/lib/actor/system/vm/thread/factory.js +2 -2
  23. package/lib/actor/system/vm/thread/factory.js.map +1 -1
  24. package/lib/actor/system/vm/thread/index.d.ts +5 -0
  25. package/lib/actor/system/vm/thread/index.js.map +1 -1
  26. package/lib/actor/system/vm/thread/process.d.ts +4 -2
  27. package/lib/actor/system/vm/thread/process.js +4 -3
  28. package/lib/actor/system/vm/thread/process.js.map +1 -1
  29. package/lib/actor/system/vm/thread/runner.d.ts +31 -0
  30. package/lib/actor/system/vm/thread/runner.js +60 -0
  31. package/lib/actor/system/vm/thread/runner.js.map +1 -0
  32. package/lib/actor/system/vm/thread/shared/js.d.ts +4 -3
  33. package/lib/actor/system/vm/thread/shared/js.js +18 -6
  34. package/lib/actor/system/vm/thread/shared/js.js.map +1 -1
  35. package/lib/actor/template.d.ts +0 -5
  36. package/lib/actor/template.js +1 -13
  37. package/lib/actor/template.js.map +1 -1
  38. package/package.json +1 -1
  39. package/lib/actor/system/vm/frame.d.ts +0 -228
  40. package/lib/actor/system/vm/frame.js +0 -233
  41. package/lib/actor/system/vm/frame.js.map +0 -1
  42. package/lib/actor/system/vm/object/foreign.d.ts +0 -9
  43. package/lib/actor/system/vm/object/foreign.js +0 -13
  44. package/lib/actor/system/vm/object/foreign.js.map +0 -1
  45. package/lib/actor/system/vm/object/index.d.ts +0 -5
  46. package/lib/actor/system/vm/object/index.js +0 -3
  47. package/lib/actor/system/vm/object/index.js.map +0 -1
  48. package/lib/actor/system/vm/object/list.d.ts +0 -8
  49. package/lib/actor/system/vm/object/list.js +0 -12
  50. package/lib/actor/system/vm/object/list.js.map +0 -1
  51. package/lib/actor/system/vm/op/actor.d.ts +0 -69
  52. package/lib/actor/system/vm/op/actor.js +0 -118
  53. package/lib/actor/system/vm/op/actor.js.map +0 -1
  54. package/lib/actor/system/vm/op/base.d.ts +0 -142
  55. package/lib/actor/system/vm/op/base.js +0 -242
  56. package/lib/actor/system/vm/op/base.js.map +0 -1
  57. package/lib/actor/system/vm/op/index.d.ts +0 -106
  58. package/lib/actor/system/vm/op/index.js +0 -232
  59. package/lib/actor/system/vm/op/index.js.map +0 -1
  60. package/lib/actor/system/vm/op/object.d.ts +0 -31
  61. package/lib/actor/system/vm/op/object.js +0 -78
  62. package/lib/actor/system/vm/op/object.js.map +0 -1
  63. package/lib/actor/system/vm/registry.d.ts +0 -126
  64. package/lib/actor/system/vm/registry.js +0 -191
  65. package/lib/actor/system/vm/registry.js.map +0 -1
  66. package/lib/actor/system/vm/script/index.d.ts +0 -49
  67. package/lib/actor/system/vm/script/index.js +0 -29
  68. package/lib/actor/system/vm/script/index.js.map +0 -1
  69. package/lib/actor/system/vm/script/info.d.ts +0 -279
  70. package/lib/actor/system/vm/script/info.js +0 -256
  71. package/lib/actor/system/vm/script/info.js.map +0 -1
  72. package/lib/actor/system/vm/type.d.ts +0 -90
  73. package/lib/actor/system/vm/type.js +0 -29
  74. package/lib/actor/system/vm/type.js.map +0 -1
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stop = exports.maildq = exports.mailcount = exports.recvcount = exports.recv = exports.send = exports.self = exports.alloc = void 0;
4
- /**
5
- * alloc allocates resources for a new child actor.
6
- *
7
- * TOS must be an instance of PTTemplate or an error will be raised.
8
- * The address of the new actor is pushed onto the stack.
9
- *
10
- * Stack:
11
- * <template> -> <address>
12
- */
13
- const alloc = (thread, frame, _) => {
14
- let eTemp = frame.popObject();
15
- if (eTemp.isLeft())
16
- return thread.raise(eTemp.takeLeft());
17
- let tmpl = eTemp.takeRight();
18
- //TODO: if(!isTemplateLike(tmpl)) return thread.raise(new Error('alloc: Cannot allocate non-template!'));
19
- //TODO: this is async
20
- thread.spawn(tmpl);
21
- /*
22
- if (eresult.isLeft()) {
23
- thread.raise(eresult.takeLeft());
24
- } else {
25
- frame.push(thread.vm.registry.addString(eresult.takeRight()));
26
- }*/
27
- };
28
- exports.alloc = alloc;
29
- /**
30
- * self puts the address of the current actor on to the stack.
31
- * TODO: make self an automatic variable
32
- */
33
- const self = (_, f, __) => {
34
- f.pushSelf();
35
- };
36
- exports.self = self;
37
- /**
38
- * send a message to another actor.
39
- *
40
- * Stack:
41
- * <message>,<address> -> <uint8>
42
- */
43
- const send = (r, f, _) => {
44
- let eMsg = f.popValue();
45
- if (eMsg.isLeft())
46
- return r.raise(eMsg.takeLeft());
47
- let eAddr = f.popString();
48
- if (eAddr.isLeft())
49
- return r.raise(eAddr.takeLeft());
50
- r.vm.sendMessage(r, eAddr.takeRight(), eMsg.takeRight());
51
- };
52
- exports.send = send;
53
- /**
54
- * recv schedules a receiver function for the next available message.
55
- *
56
- * Currently only supports foreign functions.
57
- * Will invoke the actor's notify() method if there are pending
58
- * messages.
59
- *
60
- * Stack:
61
- * <function> ->
62
- */
63
- const recv = (r, f, _) => {
64
- let einfo = f.popFunction();
65
- if (einfo.isLeft())
66
- return r.raise(einfo.takeLeft());
67
- // r.watch(r.receive());
68
- };
69
- exports.recv = recv;
70
- /**
71
- * recvcount pushes the total count of pending receives to the top of the stack.
72
- *
73
- * Stack:
74
- * -> <uint32>
75
- */
76
- const recvcount = (_r, _f, _) => {
77
- //f.push(r.context.receivers.length);
78
- };
79
- exports.recvcount = recvcount;
80
- /**
81
- * mailcount pushes the number of messages in the actor's mailbox onto the top
82
- * of the stack.
83
- *
84
- * Stack:
85
- * -> <uint32>
86
- */
87
- const mailcount = (r, f, _) => {
88
- f.push(r.mailbox.length);
89
- };
90
- exports.mailcount = mailcount;
91
- /**
92
- * maildq pushes the earliest message in the mailbox (if any).
93
- *
94
- * Stack:
95
- *
96
- * -> <message>?
97
- */
98
- const maildq = (_, f, __) => {
99
- f.pushMessage();
100
- };
101
- exports.maildq = maildq;
102
- /**
103
- * stop an actor in the system.
104
- *
105
- * The actor will be removed.
106
- *
107
- * Stack:
108
- *
109
- * <address> ->
110
- */
111
- const stop = (r, f, _) => {
112
- let eaddr = f.popString();
113
- if (eaddr.isLeft())
114
- return r.raise(eaddr.takeLeft());
115
- // r.watch(r.kill(eaddr.takeRight()));
116
- };
117
- exports.stop = stop;
118
- //# sourceMappingURL=actor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor.js","sourceRoot":"","sources":["../../../../../src/actor/system/vm/op/actor.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;GAQG;AACI,MAAM,KAAK,GAAG,CAAC,MAAgB,EAAE,KAAY,EAAE,CAAU,EAAE,EAAE;IAChE,IAAI,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAE9B,IAAI,KAAK,CAAC,MAAM,EAAE;QAAE,OAAO,MA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CAAC,QAAQ,EAAE,CAAC,CAAC;IAErD,wBAAwB;AAC5B,CAAC,CAAC;AANW,QAAA,IAAI,QAMf;AAEF;;;;;GAKG;AACI,MAAM,SAAS,GAAG,CAAC,EAAY,EAAE,EAAS,EAAE,CAAU,EAAE,EAAE;IAC7D,qCAAqC;AACzC,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEF;;;;;;GAMG;AACI,MAAM,SAAS,GAAG,CAAC,CAAW,EAAE,CAAQ,EAAE,CAAU,EAAE,EAAE;IAC3D,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEF;;;;;;GAMG;AACI,MAAM,MAAM,GAAG,CAAC,CAAW,EAAE,CAAQ,EAAE,EAAW,EAAE,EAAE;IACzD,CAAC,CAAC,WAAW,EAAE,CAAC;AACpB,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEF;;;;;;;;GAQG;AACI,MAAM,IAAI,GAAG,CAAC,CAAW,EAAE,CAAQ,EAAE,CAAU,EAAE,EAAE;IACtD,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;IAE1B,IAAI,KAAK,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAErD,sCAAsC;AAC1C,CAAC,CAAC;AANW,QAAA,IAAI,QAMf"}
@@ -1,142 +0,0 @@
1
- import { JSThread } from '../thread/shared/js';
2
- import { Frame } from '../frame';
3
- import { Operand } from '.';
4
- /**
5
- * nop does nothing.
6
- *
7
- * Stack:
8
- * ->
9
- */
10
- export declare const nop: (_: JSThread, __: Frame, ___: Operand) => void;
11
- /**
12
- * pushui8 pushes an unsigned 8bit integer onto the stack.
13
- *
14
- * Stack:
15
- * -> <uint8>
16
- */
17
- export declare const pushui8: (_: JSThread, f: Frame, oper: Operand) => void;
18
- /**
19
- * pushui16 pushes an unsigned 16bit integer onto the stack.
20
- *
21
- * Stack:
22
- * -> <uint16>
23
- */
24
- export declare const pushui16: (_: JSThread, f: Frame, oper: Operand) => void;
25
- /**
26
- * pushui32 pushes an unsigned 32bit integer onto the stack.
27
- *
28
- * NOTE: In a future revision, the operand may be treated as an index.
29
- * Stack:
30
- * -> <uint32>
31
- */
32
- export declare const pushui32: (_: JSThread, f: Frame, oper: Operand) => void;
33
- /**
34
- * lds loads a string from the constant pool onto the stack.
35
- *
36
- * Stack:
37
- * -> <string>
38
- */
39
- export declare const lds: (_: JSThread, f: Frame, idx: Operand) => void;
40
- /**
41
- * ldn loads an info object from the compiled script.
42
- *
43
- * -> <value>
44
- */
45
- export declare const ldn: (_: JSThread, f: Frame, idx: Operand) => void;
46
- /**
47
- * dup duplicates the value on top of the data stack.
48
- *
49
- * Stack:
50
- * <any> -> <any>,<any>
51
- */
52
- export declare const dup: (_: JSThread, f: Frame, __: Operand) => void;
53
- /**
54
- * store the value at the top of the data stack in the variable indicated
55
- * by idx.
56
- *
57
- * Stack:
58
- * <any> ->
59
- */
60
- export declare const store: (_: JSThread, f: Frame, idx: Operand) => void;
61
- /**
62
- * load the value stored at idx in the variables array onto the top of the
63
- * stack.
64
- *
65
- * If the variable is undefined 0 is placed on the stack.
66
- *
67
- * Stack:
68
- * -> <any>
69
- */
70
- export declare const load: (_: JSThread, f: Frame, idx: Operand) => void;
71
- /**
72
- * ceq compares two values for equality.
73
- *
74
- * Pushes 1 if true, 0 otherwise.
75
- *
76
- * Stack:
77
- *
78
- * <val1>,<val2> -> <unint32>
79
- */
80
- export declare const ceq: (r: JSThread, f: Frame, __: Operand) => Promise<void> | undefined;
81
- /**
82
- * addui32 treats the top two operands on the data stack as uint32s and adds
83
- * them.
84
- *
85
- * The result is a 32 bit value. If the result is more than MAX_SAFE_INTEGER an
86
- * IntergerOverflowErr will be raised.
87
- */
88
- export declare const addui32: (r: JSThread, f: Frame, _: Operand) => Promise<void> | undefined;
89
- /**
90
- * call a function placing its result on the heap.
91
- *
92
- * Stack:
93
- *
94
- * <arg>...? -> <result>
95
- */
96
- export declare const call: (r: JSThread, f: Frame, _: Operand) => Promise<void> | undefined;
97
- /**
98
- * raise an exception.
99
- *
100
- * Stack:
101
- *
102
- * <message> ->
103
- */
104
- export declare const raise: (r: JSThread, f: Frame, _: Operand) => void;
105
- /**
106
- * jmp jumps to the instruction at the specified address.
107
- *
108
- * Stack:
109
- * ->
110
- */
111
- export declare const jmp: (_: JSThread, f: Frame, oper: Operand) => void;
112
- /**
113
- * ifzjmp jumps to the instruction at the specified address if the top
114
- * of the stack is === 0.
115
- *
116
- * Stack:
117
- *
118
- * <uint32> ->
119
- */
120
- export declare const ifzjmp: (_: JSThread, f: Frame, oper: Operand) => void;
121
- /**
122
- * ifnzjmp jumps to the instruction at the specified address if the top
123
- * of the stack is !== 0.
124
- *
125
- * Stack:
126
- * <uint32> ->
127
- */
128
- export declare const ifnzjmp: (_: JSThread, f: Frame, oper: Operand) => void;
129
- /**
130
- * ifeqjmp jumps to the instruction at the specified address if the top
131
- * two elements of the stack are strictly equal to each other.
132
- * Stack:
133
- * <any><any> ->
134
- */
135
- export declare const ifeqjmp: (r: JSThread, f: Frame, oper: Operand) => void;
136
- /**
137
- * ifneqjmp jumps to the instruction at the specified address if the top
138
- * two elements of the stack are not strictly equal to each other.
139
- * Stack:
140
- * <any><any> ->
141
- */
142
- export declare const ifneqjmp: (r: JSThread, f: Frame, oper: Operand) => void;
@@ -1,242 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ifneqjmp = exports.ifeqjmp = exports.ifnzjmp = exports.ifzjmp = exports.jmp = exports.raise = exports.call = exports.addui32 = exports.ceq = exports.load = exports.store = exports.dup = exports.ldn = exports.lds = exports.pushui32 = exports.pushui16 = exports.pushui8 = exports.nop = void 0;
4
- const error = require("../runtime/error");
5
- const frame_1 = require("../frame");
6
- /**
7
- * nop does nothing.
8
- *
9
- * Stack:
10
- * ->
11
- */
12
- const nop = (_, __, ___) => { };
13
- exports.nop = nop;
14
- /**
15
- * pushui8 pushes an unsigned 8bit integer onto the stack.
16
- *
17
- * Stack:
18
- * -> <uint8>
19
- */
20
- const pushui8 = (_, f, oper) => {
21
- f.pushUInt8(oper);
22
- };
23
- exports.pushui8 = pushui8;
24
- /**
25
- * pushui16 pushes an unsigned 16bit integer onto the stack.
26
- *
27
- * Stack:
28
- * -> <uint16>
29
- */
30
- const pushui16 = (_, f, oper) => {
31
- f.pushUInt16(oper);
32
- };
33
- exports.pushui16 = pushui16;
34
- /**
35
- * pushui32 pushes an unsigned 32bit integer onto the stack.
36
- *
37
- * NOTE: In a future revision, the operand may be treated as an index.
38
- * Stack:
39
- * -> <uint32>
40
- */
41
- const pushui32 = (_, f, oper) => {
42
- f.pushUInt32(oper);
43
- };
44
- exports.pushui32 = pushui32;
45
- /**
46
- * lds loads a string from the constant pool onto the stack.
47
- *
48
- * Stack:
49
- * -> <string>
50
- */
51
- const lds = (_, f, idx) => {
52
- f.pushString(idx);
53
- };
54
- exports.lds = lds;
55
- /**
56
- * ldn loads an info object from the compiled script.
57
- *
58
- * -> <value>
59
- */
60
- const ldn = (_, f, idx) => {
61
- f.pushName(idx);
62
- };
63
- exports.ldn = ldn;
64
- /**
65
- * dup duplicates the value on top of the data stack.
66
- *
67
- * Stack:
68
- * <any> -> <any>,<any>
69
- */
70
- const dup = (_, f, __) => {
71
- f.duplicate();
72
- };
73
- exports.dup = dup;
74
- /**
75
- * store the value at the top of the data stack in the variable indicated
76
- * by idx.
77
- *
78
- * Stack:
79
- * <any> ->
80
- */
81
- const store = (_, f, idx) => {
82
- f.locals[idx] = f.pop();
83
- };
84
- exports.store = store;
85
- /**
86
- * load the value stored at idx in the variables array onto the top of the
87
- * stack.
88
- *
89
- * If the variable is undefined 0 is placed on the stack.
90
- *
91
- * Stack:
92
- * -> <any>
93
- */
94
- const load = (_, f, idx) => {
95
- let d = f.locals[idx];
96
- f.push(d == null ? 0 : d);
97
- };
98
- exports.load = load;
99
- /**
100
- * ceq compares two values for equality.
101
- *
102
- * Pushes 1 if true, 0 otherwise.
103
- *
104
- * Stack:
105
- *
106
- * <val1>,<val2> -> <unint32>
107
- */
108
- const ceq = (r, f, __) => {
109
- //TODO: Should null == null or raise an error?
110
- let eLhs = f.popValue();
111
- let eRhs = f.popValue();
112
- if (eLhs.isLeft())
113
- return r.raise(eLhs.takeLeft());
114
- if (eRhs.isLeft())
115
- return r.raise(eRhs.takeLeft());
116
- if (eLhs.takeRight() === eRhs.takeRight())
117
- f.push(1);
118
- else
119
- f.push(0);
120
- };
121
- exports.ceq = ceq;
122
- /**
123
- * addui32 treats the top two operands on the data stack as uint32s and adds
124
- * them.
125
- *
126
- * The result is a 32 bit value. If the result is more than MAX_SAFE_INTEGER an
127
- * IntergerOverflowErr will be raised.
128
- */
129
- const addui32 = (r, f, _) => {
130
- let val = f.pop() + f.pop();
131
- if (val > frame_1.DATA_MAX_SAFE_UINT32)
132
- return r.raise(new error.IntegerOverflowErr());
133
- f.push(val);
134
- };
135
- exports.addui32 = addui32;
136
- /**
137
- * call a function placing its result on the heap.
138
- *
139
- * Stack:
140
- *
141
- * <arg>...? -> <result>
142
- */
143
- const call = (r, f, _) => {
144
- let einfo = f.popFunction();
145
- if (einfo.isLeft())
146
- return r.raise(einfo.takeLeft());
147
- let fn = einfo.takeRight();
148
- if (fn.foreign === true) {
149
- //TODO: This is unsafe but the extent of its effect on overall stability
150
- // should be compared to the time taken to ensure each value.
151
- // let args = make(fn.argc || 0, () => f.popValue().takeRight());
152
- // r.invokeForeign(f, <ForeignFunInfo>fn, args);
153
- }
154
- else {
155
- // r.invokeVM(f, fn);
156
- }
157
- };
158
- exports.call = call;
159
- /**
160
- * raise an exception.
161
- *
162
- * Stack:
163
- *
164
- * <message> ->
165
- */
166
- const raise = (r, f, _) => {
167
- let emsg = f.popString();
168
- r.raise(new Error(emsg.takeRight()));
169
- };
170
- exports.raise = raise;
171
- /**
172
- * jmp jumps to the instruction at the specified address.
173
- *
174
- * Stack:
175
- * ->
176
- */
177
- const jmp = (_, f, oper) => {
178
- f.seek(oper);
179
- };
180
- exports.jmp = jmp;
181
- /**
182
- * ifzjmp jumps to the instruction at the specified address if the top
183
- * of the stack is === 0.
184
- *
185
- * Stack:
186
- *
187
- * <uint32> ->
188
- */
189
- const ifzjmp = (_, f, oper) => {
190
- let eValue = f.popValue();
191
- if (eValue.isLeft() || eValue.takeRight() === 0)
192
- f.seek(oper);
193
- };
194
- exports.ifzjmp = ifzjmp;
195
- /**
196
- * ifnzjmp jumps to the instruction at the specified address if the top
197
- * of the stack is !== 0.
198
- *
199
- * Stack:
200
- * <uint32> ->
201
- */
202
- const ifnzjmp = (_, f, oper) => {
203
- let eValue = f.popValue();
204
- if (eValue.isRight() && eValue.takeRight() !== 0)
205
- f.seek(oper);
206
- };
207
- exports.ifnzjmp = ifnzjmp;
208
- /**
209
- * ifeqjmp jumps to the instruction at the specified address if the top
210
- * two elements of the stack are strictly equal to each other.
211
- * Stack:
212
- * <any><any> ->
213
- */
214
- const ifeqjmp = (r, f, oper) => {
215
- let eLhs = f.popValue();
216
- let eRhs = f.popValue();
217
- if (eLhs.isLeft())
218
- r.raise(eLhs.takeLeft());
219
- else if (eRhs.isLeft())
220
- r.raise(eRhs.takeLeft());
221
- else if (eLhs.takeRight() === eRhs.takeRight())
222
- f.seek(oper);
223
- };
224
- exports.ifeqjmp = ifeqjmp;
225
- /**
226
- * ifneqjmp jumps to the instruction at the specified address if the top
227
- * two elements of the stack are not strictly equal to each other.
228
- * Stack:
229
- * <any><any> ->
230
- */
231
- const ifneqjmp = (r, f, oper) => {
232
- let eLhs = f.popValue();
233
- let eRhs = f.popValue();
234
- if (eLhs.isLeft())
235
- r.raise(eLhs.takeLeft());
236
- else if (eRhs.isLeft())
237
- r.raise(eRhs.takeLeft());
238
- else if (eLhs.takeRight() !== eRhs.takeRight())
239
- f.seek(oper);
240
- };
241
- exports.if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Q,EAAE,CAAC,CAAC;SAC5C,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC,SAAS,EAAE;QAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC,CAAC;AAPW,QAAA,OAAO,WAOlB;AAEF;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAC,CAAW,EAAE,CAAQ,EAAE,IAAa,EAAE,EAAE;IAC7D,IAAI,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;IACxB,IAAI,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;IAExB,IAAI,IAAI,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACvC,IAAI,IAAI,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC5C,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC,SAAS,EAAE;QAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB"}
@@ -1,106 +0,0 @@
1
- import { Record } from '@quenk/noni/lib/data/record';
2
- import { Type } from '@quenk/noni/lib/data/type';
3
- import { JSThread } from '../thread/shared/js';
4
- import { Frame } from '../frame';
5
- export declare const OP_CODE_RANGE_LOW = 16777216;
6
- export declare const OP_CODE_RANGE_HIGH = 4278190080;
7
- export declare const OP_CODE_RANGE_STEP = 16777216;
8
- export declare const OPCODE_MASK = 4278190080;
9
- export declare const OPERAND_MASK = 16777215;
10
- export declare const OPCODE_RANGE_START = 16777216;
11
- export declare const OPCODE_RANGE_END = 4278190080;
12
- export declare const OPERAND_RANGE_START = 0;
13
- export declare const OPERAND_RANGE_END = 16777215;
14
- export declare const MAX_INSTRUCTION = 4294967295;
15
- export declare const NOP = 16777216;
16
- export declare const PUSHUI8: number;
17
- export declare const PUSHUI16: number;
18
- export declare const PUSHUI32: number;
19
- export declare const LDS: number;
20
- export declare const LDN: number;
21
- export declare const DUP: number;
22
- export declare const STORE: number;
23
- export declare const LOAD: number;
24
- export declare const CEQ: number;
25
- export declare const ADDUI32: number;
26
- export declare const CALL: number;
27
- export declare const RAISE: number;
28
- export declare const JMP: number;
29
- export declare const IFZJMP: number;
30
- export declare const IFNZJMP: number;
31
- export declare const IFEQJMP: number;
32
- export declare const IFNEQJMP: number;
33
- export declare const ALLOC: number;
34
- export declare const SEND: number;
35
- export declare const RECV: number;
36
- export declare const RECVCOUNT: number;
37
- export declare const MAILCOUNT: number;
38
- export declare const MAILDQ: number;
39
- export declare const SELF: number;
40
- export declare const STOP: number;
41
- export declare const GETPROP: number;
42
- export declare const ARLENGTH: number;
43
- export declare const ARELM: number;
44
- /**
45
- * Opcode
46
- */
47
- export type Opcode = number;
48
- /**
49
- * Operand
50
- */
51
- export type Operand = number;
52
- /**
53
- * Instruction
54
- */
55
- export type Instruction = number;
56
- /**
57
- * OpcodeHandler
58
- */
59
- export type OpcodeHandler = (r: JSThread, f: Frame, o: Operand) => void;
60
- /**
61
- * OpcodeInfo provides needed details of a single opcode.
62
- */
63
- export interface OpcodeInfo {
64
- /**
65
- * name is the mnemonic for the opcode.
66
- */
67
- name: string;
68
- /**
69
- * handler is the implementation function.
70
- */
71
- handler: OpcodeHandler;
72
- /**
73
- * log is a function that is applied to convert the op into an op log
74
- * entry.
75
- */
76
- log: (r: JSThread, f: Frame, oper: Operand) => Type[];
77
- }
78
- /**
79
- * OpcodeInfos is a map of opcode numbers to their respective OpCodeInfo objects.
80
- */
81
- export interface OpcodeInfos extends Record<OpcodeInfo> {
82
- }
83
- /**
84
- * OpcodeHandlers
85
- */
86
- export interface OpcodeHandlers {
87
- [key: number]: OpcodeHandler;
88
- }
89
- /**
90
- * opcodes
91
- */
92
- export declare const opcodes: OpcodeInfos;
93
- /**
94
- * handlers maps opcode numbers to their handler
95
- */
96
- export declare const handlers: OpcodeHandlers;
97
- /**
98
- * toName converts an opcode to it's mnemonic.
99
- */
100
- export declare const toName: (op: Opcode) => string;
101
- /**
102
- * toLog provides a log line for an op.
103
- *
104
- * If the op is invalid an empty line is produced.
105
- */
106
- export declare const toLog: (op: Opcode, r: JSThread, f: Frame, oper: Operand) => any[];