Coverage Report

Created: 2026-09-28 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/moddable/xs/sources/xsRun.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2016-2025  Moddable Tech, Inc.
3
 *
4
 *   This file is part of the Moddable SDK Runtime.
5
 * 
6
 *   The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
 *   it under the terms of the GNU Lesser General Public License as published by
8
 *   the Free Software Foundation, either version 3 of the License, or
9
 *   (at your option) any later version.
10
 * 
11
 *   The Moddable SDK Runtime is distributed in the hope that it will be useful,
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *   GNU Lesser General Public License for more details.
15
 * 
16
 *   You should have received a copy of the GNU Lesser General Public License
17
 *   along with the Moddable SDK Runtime.  If not, see <http://www.gnu.org/licenses/>.
18
 *
19
 * This file incorporates work covered by the following copyright and  
20
 * permission notice:  
21
 *
22
 *       Copyright (C) 2010-2016 Marvell International Ltd.
23
 *       Copyright (C) 2002-2010 Kinoma, Inc.
24
 *
25
 *       Licensed under the Apache License, Version 2.0 (the "License");
26
 *       you may not use this file except in compliance with the License.
27
 *       You may obtain a copy of the License at
28
 *
29
 *        http://www.apache.org/licenses/LICENSE-2.0
30
 *
31
 *       Unless required by applicable law or agreed to in writing, software
32
 *       distributed under the License is distributed on an "AS IS" BASIS,
33
 *       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
 *       See the License for the specific language governing permissions and
35
 *       limitations under the License.
36
 */
37
38
#include "xsAll.h"
39
40
//#define mxTrace 1
41
//#define mxTraceCall 1
42
43
#define c_iszero(NUMBER) (C_FP_ZERO == c_fpclassify(NUMBER))
44
45
static void fxRunArguments(txMachine* the, txIndex offset);
46
static void fxRunBase(txMachine* the);
47
static void fxRunConstructor(txMachine* the);
48
static txBoolean fxRunDefine(txMachine* the, txSlot* instance, txSlot* check, txID id, txIndex index, txSlot* slot, txFlag mask);
49
static txBoolean fxRunDelete(txMachine* the, txSlot* instance, txID id, txIndex index);
50
static void fxRunDerived(txMachine* the);
51
static void fxRunExtends(txMachine* the);
52
static void fxRunForOf(txMachine* the);
53
static txBoolean fxRunHas(txMachine* the, txSlot* instance, txID id, txIndex index);
54
static void fxRunIn(txMachine* the);
55
static void fxRunInstantiate(txMachine* the);
56
static void fxRunProxy(txMachine* the, txSlot* instance);
57
static void fxRunInstanceOf(txMachine* the);
58
static void fxRunUsed(txMachine* the, txSlot* selector);
59
static void fxRunUsing(txMachine* the);
60
static void fxRunUsingAsync(txMachine* the);
61
static txBoolean fxIsScopableSlot(txMachine* the, txSlot* instance, txID id);
62
static txBoolean fxToNumericInteger(txMachine* the, txSlot* theSlot);
63
static txBoolean fxToNumericIntegerUnary(txMachine* the, txSlot* theSlot, txBigIntUnary op);
64
static txBoolean fxToNumericIntegerBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op);
65
static txBoolean fxToNumericNumber(txMachine* the, txSlot* theSlot);
66
static txBoolean fxToNumericNumberUnary(txMachine* the, txSlot* theSlot, txBigIntUnary op);
67
static txBoolean fxToNumericNumberBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op);
68
69
#if defined(__GNUC__) && defined(__OPTIMIZE__)
70
  #if defined(mxFrequency)
71
    #define mxBreak \
72
      the->frequencies[byte]++; \
73
      goto *bytes[byte]
74
  #elif defined(mxTrace)
75
    #define mxBreak \
76
      if (gxDoTrace) fxTraceCode(the, stack, byte); \
77
      goto *bytes[byte]
78
  #elif defined(mxMetering)
79
    #define mxBreak \
80
1.62G
      the->meterIndex += XS_CODE_METERING; \
81
1.62G
      goto *bytes[byte]
82
  #else
83
    #define mxBreak \
84
      goto *bytes[byte]
85
  #endif
86
1.70G
  #define mxCase(OPCODE) OPCODE:
87
987k
  #define mxSwitch(OPCODE) mxBreak;
88
#else
89
  #define mxBreak \
90
    break
91
  #define mxCase(OPCODE) \
92
    case OPCODE:
93
  #if defined(mxFrequency)
94
    #define mxSwitch(OPCODE) \
95
      the->frequencies[OPCODE]++; \
96
      switch(OPCODE)
97
  #else
98
    #define mxSwitch(OPCODE) \
99
      switch(OPCODE)
100
  #endif
101
#endif
102
103
6.06G
#define mxCode code
104
3.89G
#define mxFrame frame
105
848M
#define mxEnvironment environment
106
1.56G
#define mxScope scope
107
7.19G
#define mxStack stack
108
109
157M
#define mxFrameEnd (mxFrame + ((mxFrame->flag & XS_TARGET_FLAG) ? 5 : 4))
110
16.4M
#define mxFrameThis (mxFrame + 3)
111
3.26M
#define mxFrameFunction (mxFrame + 2)
112
208M
#define mxFrameResult (mxFrame + 1)
113
3.97k
#define mxFrameTarget (mxFrame + 4)
114
24.8M
#define mxFrameHasTarget (mxFrame->flag & XS_TARGET_FLAG)
115
5.47M
#define mxFrameArgc ((txInteger)(mxFrame->ID))
116
4.84M
#define mxFrameArgv(THE_INDEX) (mxFrame - 1 - (THE_INDEX))
117
118
387M
#define mxRestoreState { \
119
387M
  mxStack = the->stack; \
120
387M
  mxScope = the->scope; \
121
387M
  mxFrame = the->frame; \
122
387M
  mxEnvironment = mxFrameToEnvironment(mxFrame); \
123
387M
  mxCode = the->code; \
124
387M
}
125
30.0M
#define mxRestoreStateKeepStack { \
126
30.0M
  mxScope = the->scope; \
127
30.0M
  mxFrame = the->frame; \
128
30.0M
  mxEnvironment = mxFrameToEnvironment(mxFrame); \
129
30.0M
  mxCode = the->code; \
130
30.0M
}
131
#if defined(mxFrequency)
132
  #define mxSaveState { \
133
    the->exits[byte]++; \
134
    the->stack = mxStack; \
135
    the->scope = mxScope; \
136
    the->frame = mxFrame; \
137
    the->code = mxCode; \
138
  }
139
  #define mxSaveStateKeepStack { \
140
    the->exits[byte]++; \
141
    the->scope = mxScope; \
142
    the->frame = mxFrame; \
143
    the->code = mxCode; \
144
  }
145
#else
146
500M
  #define mxSaveState { \
147
500M
    the->stack = mxStack; \
148
500M
    the->scope = mxScope; \
149
500M
    the->frame = mxFrame; \
150
500M
    the->code = mxCode; \
151
500M
  }
152
30.0M
  #define mxSaveStateKeepStack { \
153
30.0M
    the->scope = mxScope; \
154
30.0M
    the->frame = mxFrame; \
155
30.0M
    the->code = mxCode; \
156
30.0M
  }
157
#endif
158
159
#if mxBoundsCheck
160
#define mxAllocStack(_COUNT) \
161
903M
  if ((mxStack - _COUNT) < the->stackBottom) \
162
903M
    goto STACK_OVERFLOW; \
163
903M
  mxStack -= _COUNT
164
#else
165
#define mxAllocStack(_COUNT) \
166
  mxStack -= _COUNT
167
#endif
168
169
613M
#define mxPushKind(_KIND) { \
170
613M
  mxAllocStack(1); \
171
613M
  mxStack->next = C_NULL;  \
172
613M
  mxInitSlotKind(mxStack, _KIND); \
173
613M
}
174
175
9.42M
#define mxRunDebug(_ERROR, ...) { \
176
9.42M
  mxSaveState; \
177
9.42M
  fxThrowMessage(the, NULL, 0, _ERROR, __VA_ARGS__); \
178
9.42M
}
179
180
391
#define mxRunDebugID(_ERROR, _MESSAGE, _ID) { \
181
975k
  mxSaveState; \
182
391
  fxIDToString(the, _ID, the->nameBuffer, sizeof(the->nameBuffer)); \
183
391
  fxThrowMessage(the, NULL, 0, _ERROR, _MESSAGE, the->nameBuffer); \
184
975k
}
185
186
#define mxToBoolean(SLOT) \
187
6.32M
  if (XS_BOOLEAN_KIND != (SLOT)->kind) { \
188
5.00M
    if (XS_SYMBOL_KIND <= (SLOT)->kind) { \
189
1.18M
      mxSaveState; \
190
1.18M
      fxToBoolean(the, SLOT); \
191
1.18M
      mxRestoreState; \
192
1.18M
    } \
193
5.00M
    else \
194
5.00M
      fxToBoolean(the, SLOT); \
195
5.00M
  }
196
197
#define mxToInteger(SLOT) \
198
  if (XS_INTEGER_KIND != (SLOT)->kind) { \
199
    if (XS_STRING_KIND <= (SLOT)->kind) { \
200
      mxSaveState; \
201
      fxToInteger(the, SLOT); \
202
      mxRestoreState; \
203
    } \
204
    else \
205
      fxToInteger(the, SLOT); \
206
  }
207
  
208
#define mxToNumber(SLOT) \
209
2.36M
  if (XS_NUMBER_KIND != (SLOT)->kind) { \
210
1.99M
    if (XS_STRING_KIND <= (SLOT)->kind) { \
211
1.68M
      mxSaveState; \
212
1.68M
      fxToNumber(the, SLOT); \
213
1.68M
      mxRestoreState; \
214
1.68M
    } \
215
1.99M
    else \
216
1.99M
      fxToNumber(the, SLOT); \
217
1.99M
  }
218
  
219
#define mxToString(SLOT) \
220
3.31M
  if ((XS_STRING_KIND != (SLOT)->kind) && (XS_STRING_X_KIND != (SLOT)->kind)) { \
221
2.84M
    mxSaveState; \
222
2.84M
    fxToString(the, SLOT); \
223
2.84M
    mxRestoreState; \
224
2.84M
  }
225
  
226
#define mxToInstance(SLOT) \
227
273M
  if (XS_REFERENCE_KIND != (SLOT)->kind) { \
228
21.0M
    mxSaveState; \
229
21.0M
    variable = fxToInstance(the, SLOT); \
230
21.0M
    mxRestoreState; \
231
21.0M
    primitive = 1; \
232
21.0M
  } \
233
273M
  else { \
234
252M
    variable = (SLOT)->value.reference; \
235
252M
    primitive = 0; \
236
252M
  }
237
238
#ifndef mxUnalignedAccess
239
  #define mxUnalignedAccess 1
240
#endif
241
242
222M
#define mxRunS1(OFFSET) ((txS1*)mxCode)[OFFSET]
243
215M
#define mxRunU1(OFFSET) ((txU1*)mxCode)[OFFSET]
244
#if mxBigEndian
245
  #define mxRunS2(OFFSET) (((txS1*)mxCode)[OFFSET+0] << 8) | ((txU1*)mxCode)[OFFSET+1]
246
  #define mxRunS4(OFFSET) (((txS1*)mxCode)[OFFSET+0] << 24) | (((txU1*)mxCode)[OFFSET+1] << 16) | (((txU1*)mxCode)[OFFSET+2] << 8) | ((txU1*)mxCode)[OFFSET+3]
247
  #define mxRunU2(OFFSET) (((txU1*)mxCode)[OFFSET+0] << 8) | ((txU1*)mxCode)[OFFSET+1]
248
#else
249
  #if mxUnalignedAccess
250
156M
    #define mxRunS2(OFFSET) *((txS2*)(mxCode + OFFSET))
251
430M
    #define mxRunS4(OFFSET) *((txS4*)(mxCode + OFFSET))
252
8.24M
    #define mxRunU2(OFFSET) *((txU2*)(mxCode + OFFSET))
253
  #else 
254
    #define mxRunS2(OFFSET) (((txS1*)mxCode)[OFFSET+1] << 8) | ((txU1*)mxCode)[OFFSET+0]
255
    #define mxRunS4(OFFSET) (((txS1*)mxCode)[OFFSET+3] << 24) | (((txU1*)mxCode)[OFFSET+2] << 16) | (((txU1*)mxCode)[OFFSET+1] << 8) | ((txU1*)mxCode)[OFFSET+0]
256
    #define mxRunU2(OFFSET) (((txU1*)mxCode)[OFFSET+1] << 8) | ((txU1*)mxCode)[OFFSET+0]
257
  #endif
258
#endif
259
#ifdef mx32bitID
260
420M
  #define mxRunID(OFFSET) mxRunS4(OFFSET)
261
#else
262
  #define mxRunID(OFFSET) mxRunS2(OFFSET)
263
#endif
264
265
1.57G
#define mxNextCode(OFFSET) { \
266
1.57G
  mxCode += OFFSET; \
267
1.57G
  byte = *((txU1*)mxCode); \
268
1.57G
}
269
83.1M
#define mxSkipCode(OFFSET) { \
270
83.1M
  mxCode += OFFSET; \
271
83.1M
}
272
273
#ifdef mxMetering
274
  #define mxCheckMeter() \
275
109M
    if (the->meterInterval && (the->meterIndex > the->meterCount)) { \
276
26.6k
      mxSaveState; \
277
26.6k
      fxCheckMetering(the); \
278
26.6k
      mxRestoreState; \
279
26.6k
    }
280
  #define mxBranch(INDEX, OFFSET) \
281
59.7M
    if ((OFFSET) < 0) { \
282
46.8M
      mxCheckMeter(); \
283
46.8M
    } \
284
59.7M
    mxNextCode((txS4)INDEX + OFFSET)
285
  #define mxBranchElse(TEST, INDEX, OFFSET) \
286
37.4M
    if (TEST) { \
287
29.0M
      mxNextCode((txS4)INDEX); \
288
29.0M
    } \
289
33.7M
    else { \
290
4.64M
      mxBranch(INDEX, OFFSET); \
291
4.64M
    }
292
  #define mxBranchIf(TEST, INDEX, OFFSET) \
293
31.7M
    if (TEST) { \
294
6.53M
      mxBranch(INDEX, OFFSET); \
295
6.53M
    } \
296
21.0M
    else { \
297
14.4M
      mxNextCode((txS4)index); \
298
14.4M
    }
299
  #define mxFirstCode() \
300
62.4M
    mxCheckMeter(); \
301
62.4M
    byte = *((txU1*)mxCode)
302
#else
303
  #define mxBranch(INDEX, OFFSET) \
304
    mxNextCode((txS4)INDEX + OFFSET)
305
  #define mxBranchElse(TEST, INDEX, OFFSET) \
306
    mxNextCode((TEST) ? (txS4)INDEX : (txS4)INDEX + OFFSET)
307
  #define mxBranchIf(TEST, INDEX, OFFSET) \
308
    mxNextCode((TEST) ? (txS4)INDEX + OFFSET : (txS4)INDEX)
309
  #define mxFirstCode() \
310
    byte = *((txU1*)mxCode)
311
#endif
312
313
#ifdef mxTrace
314
short gxDoTrace = 1;
315
316
#ifdef mxMetering
317
static void fxTraceCode(txMachine* the, txSlot* stack, txU1 theCode) 
318
{
319
  if (((XS_NO_CODE < theCode) && (theCode < XS_CODE_COUNT)))
320
    fprintf(stderr, "\n%u %ld: %s", the->meterIndex, the->stackTop - stack, gxCodeNames[theCode]);
321
  else
322
    fprintf(stderr, "\n%u %ld: ?", the->meterIndex, the->stackTop - stack);
323
}
324
#else
325
static void fxTraceCode(txMachine* the, txSlot* stack, txU1 theCode) 
326
{
327
  if (((XS_NO_CODE < theCode) && (theCode < XS_CODE_COUNT)))
328
    fprintf(stderr, "\n%ld: %s", (long int)(the->stackTop - stack), gxCodeNames[theCode]);
329
  else
330
    fprintf(stderr, "\n%ld: ?", (long int)(the->stackTop - stack));
331
}
332
#endif
333
334
static void fxTraceID(txMachine* the, txID id, txIndex index) 
335
{
336
  if (id) {
337
    char* key = fxGetKeyName(the, id);
338
    if (key)
339
      fprintf(stderr, " [%s]", key);
340
    else
341
      fprintf(stderr, " [?]");
342
  }
343
  else
344
    fprintf(stderr, " [%d]", (int)index);
345
}
346
347
static void fxTraceIndex(txMachine* the, txU2 theIndex) 
348
{
349
  fprintf(stderr, " %d", theIndex);
350
}
351
352
static void fxTraceInteger(txMachine* the, txInteger theInteger) 
353
{
354
  fprintf(stderr, " %ld", (long)theInteger);
355
}
356
357
static void fxTraceNumber(txMachine* the, txNumber theNumber) 
358
{
359
  fprintf(stderr, " %lf", theNumber);
360
}
361
362
static void fxTraceReturn(txMachine* the) 
363
{
364
  fprintf(stderr, "\n");
365
}
366
367
static void fxTraceString(txMachine* the, txString theString) 
368
{
369
  fprintf(stderr, " \"%s\"", theString);
370
}
371
#endif
372
373
#ifdef mxTraceCall
374
int gxTraceCall = 0;
375
static int depth = 0;
376
static void fxTraceCallBegin(txMachine* the, txSlot* function)
377
{
378
  if (gxTraceCall) {
379
    txSlot* slot = mxBehaviorGetProperty(the, function->value.reference, mxID(_name), 0, XS_ANY);
380
    int i;
381
    for (i = 0; i < depth; i++)
382
      fprintf(stderr, "\t");
383
    if (slot && ((slot->kind == XS_STRING_KIND) ||  (slot->kind == XS_STRING_X_KIND)))
384
      fprintf(stderr, " [%s]\n", slot->value.string);
385
    else
386
      fprintf(stderr, " [?]\n");
387
    depth++;
388
  }
389
}
390
static void fxTraceCallEnd(txMachine* the, txSlot* function)
391
{
392
  if (gxTraceCall) {
393
    depth--;
394
    if (depth < 0)
395
      depth = 0;
396
  }
397
}
398
#endif
399
400
#if defined(mxInstrument) && !defined(mxDebug)
401
static void fxTraceException(txMachine *the)
402
{
403
#ifndef mxNoConsole
404
  if (XS_REFERENCE_KIND == mxException.kind) {
405
    txSlot* internal = mxException.value.reference->next;
406
    if (internal && (internal->kind == XS_ERROR_KIND)) {
407
      txSlot* msg = internal->next;
408
      if (msg && ((msg->kind == XS_STRING_KIND) || (msg->kind == XS_STRING_X_KIND)))
409
        c_printf("Exception %s: %s\n", gxErrorNames[internal->value.error.which], msg->value.string);
410
      else
411
        c_printf("Exception %s\n", gxErrorNames[internal->value.error.which]);
412
    }
413
  }
414
  else
415
    c_printf("Exception\n");
416
#endif
417
}
418
#endif
419
420
void fxRunID(txMachine* the, txSlot* generator, txInteger count)
421
105M
{
422
105M
  register txSlot* stack = the->stack;
423
105M
  register txSlot* scope = the->scope;
424
105M
  register txSlot* frame = the->frame;
425
105M
  register txSlot* environment;
426
105M
  register txByte* code = the->code;
427
105M
  register txSlot* variable;
428
105M
  register txSlot* slot;
429
105M
  register txU1 byte = 0;
430
105M
  register txU4 index;
431
105M
  register txS4 offset;
432
105M
  txU1 primitive = 0;
433
105M
  txU1 ignore = 0;
434
105M
#if defined(__GNUC__) && defined(__OPTIMIZE__)
435
105M
  static void *const
436
105M
  #if !defined(__ets__) || ESP32
437
105M
    ICACHE_RAM_ATTR
438
105M
  #endif
439
105M
    gxBytes[] = {
440
105M
    &&XS_NO_CODE,
441
105M
    &&XS_CODE_ADD,
442
105M
    &&XS_CODE_ARGUMENT,
443
105M
    &&XS_CODE_ARGUMENTS,
444
105M
    &&XS_CODE_ARGUMENTS_SLOPPY,
445
105M
    &&XS_CODE_ARGUMENTS_STRICT,
446
105M
    &&XS_CODE_ARRAY,
447
105M
    &&XS_CODE_ASYNC_FUNCTION,
448
105M
    &&XS_CODE_ASYNC_GENERATOR_FUNCTION,
449
105M
    &&XS_CODE_AT,
450
105M
    &&XS_CODE_AWAIT,
451
105M
    &&XS_CODE_BEGIN_SLOPPY,
452
105M
    &&XS_CODE_BEGIN_STRICT,
453
105M
    &&XS_CODE_BEGIN_STRICT_BASE,
454
105M
    &&XS_CODE_BEGIN_STRICT_DERIVED,
455
105M
    &&XS_CODE_BEGIN_STRICT_FIELD,
456
105M
    &&XS_CODE_BIGINT_1,
457
105M
    &&XS_CODE_BIGINT_2,
458
105M
    &&XS_CODE_BIT_AND,
459
105M
    &&XS_CODE_BIT_NOT,
460
105M
    &&XS_CODE_BIT_OR,
461
105M
    &&XS_CODE_BIT_XOR,
462
105M
    &&XS_CODE_BRANCH_1,
463
105M
    &&XS_CODE_BRANCH_2,
464
105M
    &&XS_CODE_BRANCH_4,
465
105M
    &&XS_CODE_BRANCH_CHAIN_1,
466
105M
    &&XS_CODE_BRANCH_CHAIN_2,
467
105M
    &&XS_CODE_BRANCH_CHAIN_4,
468
105M
    &&XS_CODE_BRANCH_COALESCE_1,
469
105M
    &&XS_CODE_BRANCH_COALESCE_2,
470
105M
    &&XS_CODE_BRANCH_COALESCE_4,
471
105M
    &&XS_CODE_BRANCH_ELSE_1,
472
105M
    &&XS_CODE_BRANCH_ELSE_2,
473
105M
    &&XS_CODE_BRANCH_ELSE_4,
474
105M
    &&XS_CODE_BRANCH_IF_1,
475
105M
    &&XS_CODE_BRANCH_IF_2,
476
105M
    &&XS_CODE_BRANCH_IF_4,
477
105M
    &&XS_CODE_BRANCH_STATUS_1,
478
105M
    &&XS_CODE_BRANCH_STATUS_2,
479
105M
    &&XS_CODE_BRANCH_STATUS_4,
480
105M
    &&XS_CODE_CALL,
481
105M
    &&XS_CODE_CATCH_1,
482
105M
    &&XS_CODE_CATCH_2,
483
105M
    &&XS_CODE_CATCH_4,
484
105M
    &&XS_CODE_CHECK_INSTANCE,
485
105M
    &&XS_CODE_CLASS,
486
105M
    &&XS_CODE_CODE_1,
487
105M
    &&XS_CODE_CODE_2,
488
105M
    &&XS_CODE_CODE_4,
489
105M
    &&XS_CODE_CODE_ARCHIVE_1,
490
105M
    &&XS_CODE_CODE_ARCHIVE_2,
491
105M
    &&XS_CODE_CODE_ARCHIVE_4,
492
105M
    &&XS_CODE_CONST_CLOSURE_1,
493
105M
    &&XS_CODE_CONST_CLOSURE_2,
494
105M
    &&XS_CODE_CONST_LOCAL_1,
495
105M
    &&XS_CODE_CONST_LOCAL_2,
496
105M
    &&XS_CODE_CONSTRUCTOR_FUNCTION,
497
105M
    &&XS_CODE_COPY_OBJECT,
498
105M
    &&XS_CODE_CURRENT,
499
105M
    &&XS_CODE_DEBUGGER,
500
105M
    &&XS_CODE_DECREMENT,
501
105M
    &&XS_CODE_DELETE_PROPERTY,
502
105M
    &&XS_CODE_DELETE_PROPERTY_AT,
503
105M
    &&XS_CODE_DELETE_SUPER,
504
105M
    &&XS_CODE_DELETE_SUPER_AT,
505
105M
    &&XS_CODE_DIVIDE,
506
105M
    &&XS_CODE_DUB,
507
105M
    &&XS_CODE_DUB_AT,
508
105M
    &&XS_CODE_END,
509
105M
    &&XS_CODE_END_ARROW,
510
105M
    &&XS_CODE_END_BASE,
511
105M
    &&XS_CODE_END_DERIVED,
512
105M
    &&XS_CODE_ENVIRONMENT,
513
105M
    &&XS_CODE_EQUAL,
514
105M
    &&XS_CODE_EVAL,
515
105M
    &&XS_CODE_EVAL_ENVIRONMENT,
516
105M
    &&XS_CODE_EVAL_PRIVATE,
517
105M
    &&XS_CODE_EVAL_REFERENCE,
518
105M
    &&XS_CODE_EVAL_TAIL,
519
105M
    &&XS_CODE_EXCEPTION,
520
105M
    &&XS_CODE_EXPONENTIATION,
521
105M
    &&XS_CODE_EXTEND,
522
105M
    &&XS_CODE_FALSE,
523
105M
    &&XS_CODE_FILE,
524
105M
    &&XS_CODE_FOR_AWAIT_OF,
525
105M
    &&XS_CODE_FOR_IN,
526
105M
    &&XS_CODE_FOR_OF,
527
105M
    &&XS_CODE_FUNCTION,
528
105M
    &&XS_CODE_FUNCTION_ENVIRONMENT,
529
105M
    &&XS_CODE_GENERATOR_FUNCTION,
530
105M
    &&XS_CODE_GET_CLOSURE_1,
531
105M
    &&XS_CODE_GET_CLOSURE_2,
532
105M
    &&XS_CODE_GET_LOCAL_1,
533
105M
    &&XS_CODE_GET_LOCAL_2,
534
105M
    &&XS_CODE_GET_PRIVATE_1,
535
105M
    &&XS_CODE_GET_PRIVATE_2,
536
105M
    &&XS_CODE_GET_PROPERTY,
537
105M
    &&XS_CODE_GET_PROPERTY_AT,
538
105M
    &&XS_CODE_GET_RESULT,
539
105M
    &&XS_CODE_GET_SUPER,
540
105M
    &&XS_CODE_GET_SUPER_AT,
541
105M
    &&XS_CODE_GET_THIS,
542
105M
    &&XS_CODE_GET_VARIABLE,
543
105M
    &&XS_CODE_GET_THIS_VARIABLE,
544
105M
    &&XS_CODE_GLOBAL,
545
105M
    &&XS_CODE_HAS_PRIVATE_1,
546
105M
    &&XS_CODE_HAS_PRIVATE_2,
547
105M
    &&XS_CODE_HOST,
548
105M
    &&XS_CODE_IMPORT,
549
105M
    &&XS_CODE_IMPORT_META,
550
105M
    &&XS_CODE_IN,
551
105M
    &&XS_CODE_INCREMENT,
552
105M
    &&XS_CODE_INSTANCEOF,
553
105M
    &&XS_CODE_INSTANTIATE,
554
105M
    &&XS_CODE_INTEGER_1,
555
105M
    &&XS_CODE_INTEGER_2,
556
105M
    &&XS_CODE_INTEGER_4,
557
105M
    &&XS_CODE_LEFT_SHIFT,
558
105M
    &&XS_CODE_LESS,
559
105M
    &&XS_CODE_LESS_EQUAL,
560
105M
    &&XS_CODE_LET_CLOSURE_1,
561
105M
    &&XS_CODE_LET_CLOSURE_2,
562
105M
    &&XS_CODE_LET_LOCAL_1,
563
105M
    &&XS_CODE_LET_LOCAL_2,
564
105M
    &&XS_CODE_LINE,
565
105M
    &&XS_CODE_MINUS,
566
105M
    &&XS_CODE_MODULE,
567
105M
    &&XS_CODE_MODULO,
568
105M
    &&XS_CODE_MORE,
569
105M
    &&XS_CODE_MORE_EQUAL,
570
105M
    &&XS_CODE_MULTIPLY,
571
105M
    &&XS_CODE_NAME,
572
105M
    &&XS_CODE_NEW,
573
105M
    &&XS_CODE_NEW_CLOSURE,
574
105M
    &&XS_CODE_NEW_LOCAL,
575
105M
    &&XS_CODE_NEW_PRIVATE_1,
576
105M
    &&XS_CODE_NEW_PRIVATE_2,
577
105M
    &&XS_CODE_NEW_PROPERTY,
578
105M
    &&XS_CODE_NEW_PROPERTY_AT,
579
105M
    &&XS_CODE_NEW_TEMPORARY,
580
105M
    &&XS_CODE_NOT,
581
105M
    &&XS_CODE_NOT_EQUAL,
582
105M
    &&XS_CODE_NULL,
583
105M
    &&XS_CODE_NUMBER,
584
105M
    &&XS_CODE_OBJECT,
585
105M
    &&XS_CODE_PLUS,
586
105M
    &&XS_CODE_POP,
587
105M
    &&XS_CODE_PROGRAM_ENVIRONMENT,
588
105M
    &&XS_CODE_PROGRAM_REFERENCE,
589
105M
    &&XS_CODE_PULL_CLOSURE_1,
590
105M
    &&XS_CODE_PULL_CLOSURE_2,
591
105M
    &&XS_CODE_PULL_LOCAL_1,
592
105M
    &&XS_CODE_PULL_LOCAL_2,
593
105M
    &&XS_CODE_REFRESH_CLOSURE_1,
594
105M
    &&XS_CODE_REFRESH_CLOSURE_2,
595
105M
    &&XS_CODE_REFRESH_LOCAL_1,
596
105M
    &&XS_CODE_REFRESH_LOCAL_2,
597
105M
    &&XS_CODE_REGEXP,
598
105M
    &&XS_CODE_RESERVE_1,
599
105M
    &&XS_CODE_RESERVE_2,
600
105M
    &&XS_CODE_RESET_CLOSURE_1,
601
105M
    &&XS_CODE_RESET_CLOSURE_2,
602
105M
    &&XS_CODE_RESET_LOCAL_1,
603
105M
    &&XS_CODE_RESET_LOCAL_2,
604
105M
    &&XS_CODE_RETHROW,
605
105M
    &&XS_CODE_RETRIEVE_1,
606
105M
    &&XS_CODE_RETRIEVE_2,
607
105M
    &&XS_CODE_RETRIEVE_TARGET,
608
105M
    &&XS_CODE_RETRIEVE_THIS,
609
105M
    &&XS_CODE_RETURN,
610
105M
    &&XS_CODE_RUN,
611
105M
    &&XS_CODE_RUN_1,
612
105M
    &&XS_CODE_RUN_2,
613
105M
    &&XS_CODE_RUN_4,
614
105M
    &&XS_CODE_RUN_TAIL,
615
105M
    &&XS_CODE_RUN_TAIL_1,
616
105M
    &&XS_CODE_RUN_TAIL_2,
617
105M
    &&XS_CODE_RUN_TAIL_4,
618
105M
    &&XS_CODE_SET_CLOSURE_1,
619
105M
    &&XS_CODE_SET_CLOSURE_2,
620
105M
    &&XS_CODE_SET_HOME,
621
105M
    &&XS_CODE_SET_LOCAL_1,
622
105M
    &&XS_CODE_SET_LOCAL_2,
623
105M
    &&XS_CODE_SET_PRIVATE_1,
624
105M
    &&XS_CODE_SET_PRIVATE_2,
625
105M
    &&XS_CODE_SET_PROPERTY,
626
105M
    &&XS_CODE_SET_PROPERTY_AT,
627
105M
    &&XS_CODE_SET_RESULT,
628
105M
    &&XS_CODE_SET_SUPER,
629
105M
    &&XS_CODE_SET_SUPER_AT,
630
105M
    &&XS_CODE_SET_THIS,
631
105M
    &&XS_CODE_SET_VARIABLE,
632
105M
    &&XS_CODE_SIGNED_RIGHT_SHIFT,
633
105M
    &&XS_CODE_START_ASYNC,
634
105M
    &&XS_CODE_START_ASYNC_GENERATOR,
635
105M
    &&XS_CODE_START_GENERATOR,
636
105M
    &&XS_CODE_STORE_1,
637
105M
    &&XS_CODE_STORE_2,
638
105M
    &&XS_CODE_STORE_ARROW,
639
105M
    &&XS_CODE_STRICT_EQUAL,
640
105M
    &&XS_CODE_STRICT_NOT_EQUAL,
641
105M
    &&XS_CODE_STRING_1,
642
105M
    &&XS_CODE_STRING_2,
643
105M
    &&XS_CODE_STRING_4,
644
105M
    &&XS_CODE_STRING_ARCHIVE_1,
645
105M
    &&XS_CODE_STRING_ARCHIVE_2,
646
105M
    &&XS_CODE_STRING_ARCHIVE_4,
647
105M
    &&XS_CODE_SUBTRACT,
648
105M
    &&XS_CODE_SUPER,
649
105M
    &&XS_CODE_SWAP,
650
105M
    &&XS_CODE_SYMBOL,
651
105M
    &&XS_CODE_TARGET,
652
105M
    &&XS_CODE_TEMPLATE,
653
105M
    &&XS_CODE_TEMPLATE_CACHE,
654
105M
    &&XS_CODE_THIS,
655
105M
    &&XS_CODE_THROW,
656
105M
    &&XS_CODE_THROW_STATUS,
657
105M
    &&XS_CODE_TO_INSTANCE,
658
105M
    &&XS_CODE_TO_NUMERIC,
659
105M
    &&XS_CODE_TO_STRING,
660
105M
    &&XS_CODE_TRANSFER,
661
105M
    &&XS_CODE_TRUE,
662
105M
    &&XS_CODE_TYPEOF,
663
105M
    &&XS_CODE_UNCATCH,
664
105M
    &&XS_CODE_UNDEFINED,
665
105M
    &&XS_CODE_UNSIGNED_RIGHT_SHIFT,
666
105M
    &&XS_CODE_UNWIND_1,
667
105M
    &&XS_CODE_UNWIND_2,
668
105M
    &&XS_CODE_VAR_CLOSURE_1,
669
105M
    &&XS_CODE_VAR_CLOSURE_2,
670
105M
    &&XS_CODE_VAR_LOCAL_1,
671
105M
    &&XS_CODE_VAR_LOCAL_2,
672
105M
    &&XS_CODE_VOID,
673
105M
    &&XS_CODE_WITH,
674
105M
    &&XS_CODE_WITHOUT,
675
105M
    &&XS_CODE_YIELD,
676
105M
    &&XS_CODE_PROFILE,
677
105M
    &&XS_CODE_YIELD_STAR,
678
105M
    &&XS_CODE_USED_1,
679
105M
    &&XS_CODE_USED_2,
680
105M
    &&XS_CODE_USING,
681
105M
    &&XS_CODE_USING_ASYNC,
682
105M
    &&XS_CODE_AT_2,
683
105M
    &&XS_CODE_SUPER_AT,
684
105M
    &&XS_CODE_SUPER_AT_2,
685
105M
    &&XS_CODE_TRANSFER_JSON,
686
105M
  };
687
105M
  register void * const *bytes = gxBytes;
688
105M
#endif
689
105M
  txJump* jump = C_NULL;
690
105M
  txSlot scratch;
691
105M
  txSlot** address;
692
105M
  txJump* yieldJump = the->firstJump;
693
694
105M
  mxCheckCStack();
695
105M
  if (generator) {
696
987k
    slot = mxStack;
697
987k
    variable = generator->next;
698
987k
    offset = variable->value.stack.length;
699
987k
    mxAllocStack(offset);
700
987k
    c_memcpy(mxStack, variable->value.stack.address, offset * sizeof(txSlot));
701
987k
    mxCode = (mxStack++)->value.reference->next->value.code.address;
702
987k
    offset = (mxStack++)->value.integer;
703
987k
    while (offset) {
704
41
      jump = c_malloc(sizeof(txJump));
705
41
      if (jump) {
706
41
        jump->nextJump = the->firstJump;
707
41
        jump->stack = slot - (mxStack++)->value.integer;
708
41
        jump->frame = slot - (mxStack++)->value.integer;
709
41
        jump->scope = slot - (mxStack++)->value.integer;
710
41
        jump->code = mxCode + (mxStack++)->value.integer;
711
41
        jump->flag = 1;
712
41
                the->firstJump = jump;
713
41
        if (c_setjmp(jump->buffer) == 1) {
714
17
          jump = the->firstJump;
715
17
                    the->firstJump = jump->nextJump;
716
17
          mxStack = jump->stack;
717
17
          mxScope = jump->scope;
718
17
          mxFrame = jump->frame;
719
17
          mxEnvironment = mxFrameToEnvironment(mxFrame);
720
17
          mxCode = jump->code;
721
17
          c_free(jump);
722
17
          goto XS_CODE_JUMP;
723
17
        }
724
41
      }
725
0
      else {
726
0
        mxSaveState;
727
0
        fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
728
0
      }
729
24
      offset--;
730
24
    }
731
987k
    variable = slot - (mxStack++)->value.integer;
732
987k
    variable->next = mxFrame;
733
987k
    variable->value.frame.code = the->code;
734
987k
    variable->value.frame.scope = mxScope;
735
987k
    mxFrame = variable;
736
987k
    mxEnvironment = mxFrameToEnvironment(mxFrame);
737
987k
    mxScope = slot - (mxStack++)->value.integer;
738
987k
    mxCode = mxCode + (mxStack++)->value.integer;
739
987k
    mxStack->kind = the->scratch.kind;
740
987k
    mxStack->value = the->scratch.value;
741
#ifdef mxTraceCall
742
    fxTraceCallBegin(the, mxFrameFunction);
743
#endif
744
987k
XS_CODE_JUMP:
745
987k
    mxFirstCode();
746
987k
  }
747
104M
  else {
748
104M
    offset = count;
749
104M
    goto XS_CODE_RUN_ALL;
750
104M
  }
751
987k
  for (;;) {
752
753
#ifdef mxTrace
754
    if (gxDoTrace) fxTraceCode(the, stack, byte);
755
#endif
756
987k
#ifdef mxMetering
757
987k
    the->meterIndex += XS_CODE_METERING;
758
987k
#endif
759
    
760
987k
    mxSwitch(byte) {
761
987k
    mxCase(XS_NO_CODE)
762
0
      mxBreak;
763
764
863k
    mxCase(XS_CODE_RUN_TAIL)
765
863k
      mxSkipCode(1);
766
863k
      offset = mxStack->value.integer;
767
863k
      mxStack++;
768
863k
      goto XS_CODE_RUN_TAIL_ALL;
769
0
    mxCase(XS_CODE_RUN_TAIL_4)
770
0
      offset = mxRunS4(1);
771
0
      mxSkipCode(5);
772
0
      goto XS_CODE_RUN_TAIL_ALL;
773
0
    mxCase(XS_CODE_RUN_TAIL_2)
774
0
      offset = mxRunS2(1);
775
0
      mxSkipCode(3);
776
0
      goto XS_CODE_RUN_TAIL_ALL;
777
3.52k
    mxCase(XS_CODE_RUN_TAIL_1)
778
3.52k
      offset = mxRunS1(1);
779
3.52k
      mxSkipCode(2);
780
866k
    XS_CODE_RUN_TAIL_ALL:
781
866k
      if (mxFrameHasTarget)
782
3
        goto XS_CODE_RUN_ALL;
783
866k
#ifdef mxDebug
784
866k
      slot = mxStack + offset + 2;
785
866k
      if (!fxIsCallable(the, slot))
786
3.14k
        goto XS_CODE_RUN_ALL;
787
863k
#endif
788
863k
      variable = mxFrameEnd - 4 - offset;
789
863k
      mxScope = mxFrame->value.frame.scope;
790
863k
      mxCode = mxFrame->value.frame.code;
791
863k
      mxFrame = mxFrame->next;
792
863k
      c_memmove(variable, mxStack, (4 + offset) * sizeof(txSlot));
793
863k
      mxStack = variable;
794
863k
      goto XS_CODE_RUN_ALL;
795
796
15.4k
    mxCase(XS_CODE_RUN)
797
15.4k
      mxSkipCode(1);
798
15.4k
      offset = mxStack->value.integer;
799
15.4k
      mxStack++;
800
15.4k
      goto XS_CODE_RUN_ALL;
801
0
    mxCase(XS_CODE_RUN_4)
802
0
      offset = mxRunS4(1);
803
0
      mxSkipCode(5);
804
0
      goto XS_CODE_RUN_ALL;
805
42.9k
    mxCase(XS_CODE_RUN_2)
806
42.9k
      offset = mxRunS2(1);
807
42.9k
      mxSkipCode(3);
808
42.9k
      goto XS_CODE_RUN_ALL;
809
43.9M
    mxCase(XS_CODE_RUN_1)
810
43.9M
      offset = mxRunS1(1);
811
43.9M
      mxSkipCode(2);
812
158M
    XS_CODE_RUN_ALL:
813
#ifdef mxTrace
814
      if (gxDoTrace) fxTraceInteger(the, offset);
815
#endif
816
158M
      slot = mxStack + offset;
817
      // FRAME
818
158M
      slot->kind = XS_FRAME_KIND;
819
158M
      slot->next = mxFrame;
820
158M
      slot->flag = slot->flag & XS_TARGET_FLAG;
821
158M
      slot->ID = (txID)offset; // COUNT
822
158M
#ifdef mxDebug
823
158M
      if (mxFrame && (mxFrame->flag & XS_STEP_INTO_FLAG))
824
0
        slot->flag |= XS_STEP_INTO_FLAG | XS_STEP_OVER_FLAG;
825
158M
#endif
826
158M
      slot->value.frame.code = mxCode;
827
158M
      slot->value.frame.scope = mxScope;
828
158M
      slot++;
829
      // RESULT
830
158M
      slot++;
831
      // FUNCTION
832
158M
      byte = ((slot + 1)->kind == XS_UNINITIALIZED_KIND) ? 1 : 0;
833
158M
      if (byte)
834
6.57M
        (mxStack + offset)->flag |= XS_TARGET_FLAG;
835
158M
      if (slot->kind == XS_REFERENCE_KIND) {
836
158M
        variable = slot->value.reference;
837
158M
        slot = variable->next;
838
158M
        if (slot && (slot->flag & XS_INTERNAL_FLAG)) {
839
158M
          if ((slot->kind == XS_CODE_KIND) || (slot->kind == XS_CODE_X_KIND)) {
840
9.25M
            if (byte && !mxIsConstructor(variable))
841
9.25M
              mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
842
9.25M
            variable = slot->value.code.closures;
843
9.25M
            if (variable) {
844
3.82M
              mxPushKind(XS_REFERENCE_KIND);
845
3.82M
              mxStack->value.environment.variable.reference = variable;
846
3.82M
            }
847
5.43M
            else {
848
5.43M
              mxPushKind(XS_NULL_KIND);
849
5.43M
              mxStack->value.environment.variable.reference = C_NULL;
850
5.43M
            }
851
9.25M
      #ifdef mxDebug
852
9.25M
            mxStack->ID = XS_NO_ID;
853
9.25M
            mxStack->value.environment.line = 0;
854
9.25M
      #endif
855
9.25M
            mxFrame = mxStack + 1 + offset;
856
9.25M
            mxEnvironment = mxStack;
857
9.25M
            mxScope = mxStack;
858
9.25M
            mxCode = slot->value.code.address;
859
      #ifdef mxTraceCall
860
            fxTraceCallBegin(the, mxFrameFunction);
861
      #endif
862
9.25M
            mxFirstCode();
863
9.25M
            mxBreak;
864
9.25M
          }
865
158M
          if ((slot->kind == XS_CALLBACK_KIND) || (slot->kind == XS_CALLBACK_X_KIND)) {
866
148M
            if (byte && !mxIsConstructor(variable))
867
148M
              mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
868
148M
            mxPushKind(XS_VAR_KIND);
869
148M
            mxStack->value.environment.variable.count = 0;
870
148M
      #ifdef mxDebug
871
148M
            mxStack->ID = XS_NO_ID;
872
148M
            mxStack->value.environment.line = 0;
873
148M
      #endif
874
148M
            mxFrame = mxStack + 1 + offset;
875
148M
            mxFrame->flag |= XS_C_FLAG;
876
148M
            mxScope = mxStack;
877
148M
            mxCode = C_NULL;
878
148M
            byte = XS_CODE_CALL;
879
      #ifdef mxTraceCall
880
            fxTraceCallBegin(the, mxFrameFunction);
881
      #endif
882
148M
            mxSaveState;
883
      #ifdef mxLink
884
            if ((txU1*)slot->value.callback.address - (txU1*)the->fakeCallback < 0)
885
              mxRunDebug(XS_TYPE_ERROR, "link: unavailable function");
886
      #endif
887
148M
            if (slot->flag & XS_BASE_FLAG)
888
0
              fxRunBase(the);
889
148M
            else if (slot->flag & XS_DERIVED_FLAG)
890
0
              fxRunDerived(the);
891
148M
            (*(slot->value.callback.address))(the);
892
148M
            mxRestoreState;
893
148M
            if (mxCode) {
894
863k
              byte = *mxCode;
895
863k
              mxBreak;
896
863k
            }
897
148M
      #if defined(mxInstrument) || defined(mxProfile)
898
148M
            fxCheckProfiler(the, mxFrame);
899
148M
      #endif
900
148M
            if (slot->flag & XS_BASE_FLAG)
901
0
              goto XS_CODE_END_BASE_ALL;
902
148M
            if (slot->flag & XS_DERIVED_FLAG)
903
0
              goto XS_CODE_END_DERIVED_ALL;
904
148M
            slot = mxFrameResult;
905
148M
            goto XS_CODE_END_ALL;
906
148M
          }
907
9.37M
          if (slot->kind == XS_PROXY_KIND) {
908
110k
            mxPushKind(XS_VAR_KIND);
909
110k
            mxStack->value.environment.variable.count = 0;
910
110k
      #ifdef mxDebug
911
110k
            mxStack->ID = XS_NO_ID;
912
110k
            mxStack->value.environment.line = 0;
913
110k
      #endif
914
110k
            mxFrame = mxStack + 1 + offset;
915
110k
            mxFrame->flag |= XS_C_FLAG;
916
110k
            mxScope = mxStack;
917
110k
            mxCode = C_NULL;
918
110k
            byte = XS_CODE_CALL;
919
      #ifdef mxTraceCall
920
            fxTraceCallBegin(the, mxFrameFunction);
921
      #endif
922
110k
            mxSaveState;
923
110k
            fxRunProxy(the, variable);
924
110k
            mxRestoreState;
925
110k
            slot = mxFrameResult;
926
110k
            goto XS_CODE_END_ALL;
927
110k
          }
928
9.37M
        }
929
158M
      }
930
#if mxHostFunctionPrimitive
931
      else if (slot->kind == XS_HOST_FUNCTION_KIND) {
932
        if (byte)
933
          mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
934
        mxPushKind(XS_VAR_KIND);
935
        mxStack->value.environment.variable.count = 0;
936
#ifdef mxDebug
937
        mxStack->ID = XS_NO_ID;
938
        mxStack->value.environment.line = 0;
939
#endif
940
        mxFrame = mxStack + 1 + offset;
941
        mxFrame->flag |= XS_C_FLAG;
942
        mxScope = mxStack;
943
        mxCode = C_NULL;
944
        byte = XS_CODE_CALL;
945
#ifdef mxTraceCall
946
        fxTraceCallBegin(the, mxFrameFunction);
947
#endif
948
        mxSaveState;
949
#ifdef mxLink
950
        if ((txU1*)slot->value.hostFunction.builder->callback - (txU1*)the->fakeCallback < 0)
951
          mxRunDebug(XS_TYPE_ERROR, "link: unavailable function");
952
#endif
953
        (*(slot->value.hostFunction.builder->callback))(the);
954
        mxRestoreState;
955
        if (mxCode) {
956
          byte = *mxCode;
957
          mxBreak;
958
        }
959
        slot = mxFrameResult;
960
        goto XS_CODE_END_ALL;
961
      }
962
#endif
963
9.42M
      if (byte) {
964
4.03k
        mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
965
0
      }
966
9.41M
      else {
967
9.41M
        mxRunDebug(XS_TYPE_ERROR, "call: not a function");
968
0
      }
969
0
      mxBreak;
970
      
971
7.81M
    mxCase(XS_CODE_BEGIN_SLOPPY)
972
7.81M
            if (mxFrameHasTarget && (mxFrameFunction->value.reference->flag & XS_CAN_CONSTRUCT_FLAG)) {
973
143k
        mxSaveState;
974
143k
        fxRunConstructor(the);
975
143k
        mxRestoreState;
976
143k
      }
977
7.66M
      else {
978
7.66M
        index = mxFrameThis->kind;
979
7.66M
        if (index < XS_REFERENCE_KIND) {
980
2.82M
          if ((index == XS_UNDEFINED_KIND) || (index == XS_NULL_KIND)) {
981
2.78M
            mxFrameThis->kind = XS_REFERENCE_KIND;
982
2.78M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
983
2.78M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
984
2.78M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
985
2.78M
            mxFrameThis->value.reference = mxRealmGlobal(variable)->value.reference;
986
2.78M
          }
987
34.1k
          else {
988
34.1k
            mxSaveState;
989
34.1k
            fxToInstance(the, mxFrameThis);
990
34.1k
            mxRestoreState;
991
34.1k
          }
992
2.82M
        }
993
7.66M
      }
994
7.81M
      mxNextCode(2);
995
7.81M
      mxBreak;
996
7.81M
    mxCase(XS_CODE_BEGIN_STRICT)
997
999k
      mxFrame->flag |= XS_STRICT_FLAG;
998
999k
            if (mxFrameHasTarget && (mxFrameFunction->value.reference->flag & XS_CAN_CONSTRUCT_FLAG)) {
999
5
        mxSaveState;
1000
5
        fxRunConstructor(the);
1001
5
        mxRestoreState;
1002
5
      }
1003
999k
      mxNextCode(2);
1004
999k
      mxBreak;
1005
999k
    mxCase(XS_CODE_BEGIN_STRICT_BASE)
1006
22.0k
      mxFrame->flag |= XS_STRICT_FLAG;
1007
22.0k
      mxSaveState;
1008
22.0k
      fxRunBase(the);
1009
22.0k
      mxRestoreState;
1010
22.0k
      mxNextCode(2);
1011
22.0k
      mxBreak;
1012
22.0k
    mxCase(XS_CODE_BEGIN_STRICT_DERIVED)
1013
222
      mxFrame->flag |= XS_STRICT_FLAG;
1014
222
      mxSaveState;
1015
222
      fxRunDerived(the);
1016
222
      mxRestoreState;
1017
222
      mxNextCode(2);
1018
222
      mxBreak;
1019
19.6k
    mxCase(XS_CODE_BEGIN_STRICT_FIELD)
1020
19.6k
      mxFrame->flag |= XS_STRICT_FLAG | XS_FIELD_FLAG;
1021
19.6k
            if (mxFrameHasTarget) {
1022
0
        mxSaveState;
1023
0
        fxRunConstructor(the);
1024
0
        mxRestoreState;
1025
0
      }
1026
19.6k
      mxNextCode(2);
1027
19.6k
      mxBreak;
1028
          
1029
451k
    mxCase(XS_CODE_END_ARROW)
1030
451k
      slot = mxFrameResult;
1031
451k
      goto XS_CODE_END_ALL;
1032
3.81k
    mxCase(XS_CODE_END_BASE)
1033
3.81k
    XS_CODE_END_BASE_ALL:
1034
3.81k
      slot = mxFrameResult;
1035
3.81k
      if (slot->kind != XS_REFERENCE_KIND)
1036
3.80k
        slot = mxFrameThis;
1037
3.81k
      goto XS_CODE_END_ALL;
1038
213
    mxCase(XS_CODE_END_DERIVED)
1039
213
    XS_CODE_END_DERIVED_ALL:
1040
213
      slot = mxFrameResult;
1041
213
      if (slot->kind != XS_REFERENCE_KIND) {
1042
195
        if ((slot->kind != XS_UNDEFINED_KIND) && (slot->kind != XS_CLOSURE_KIND))
1043
194
          mxRunDebug(XS_TYPE_ERROR, "result: invalid constructor");
1044
194
        slot = mxFrameThis->value.closure;
1045
194
        if (slot->kind < 0)
1046
187
          mxRunDebug(XS_REFERENCE_ERROR, "this: not initialized");
1047
187
      }
1048
205
      goto XS_CODE_END_ALL;
1049
3.82M
    mxCase(XS_CODE_END)
1050
3.82M
      slot = mxFrameResult;
1051
3.82M
      if (mxFrameHasTarget) {
1052
273
        if (slot->kind != XS_REFERENCE_KIND)
1053
222
          slot = mxFrameThis;
1054
273
      }
1055
153M
    XS_CODE_END_ALL:
1056
#ifdef mxTraceCall
1057
      fxTraceCallEnd(the, mxFrameFunction);
1058
#endif
1059
#ifdef mxInstrument
1060
      if (the->stackPeak > mxStack)
1061
        the->stackPeak = mxStack;
1062
#endif
1063
153M
      mxStack = mxFrameEnd;
1064
153M
      mxScope = mxFrame->value.frame.scope;
1065
153M
      mxCode = mxFrame->value.frame.code;
1066
153M
      mxAllocStack(1);
1067
153M
      *mxStack = *slot;
1068
153M
      mxFrame = mxFrame->next;
1069
153M
      if (!mxFrame || (mxFrame->flag & XS_C_FLAG)) {
1070
#ifdef mxTrace
1071
        if (gxDoTrace) fxTraceReturn(the);
1072
#endif
1073
102M
        byte = XS_CODE_END;
1074
102M
        mxSaveState;
1075
102M
        return; 
1076
102M
      }
1077
51.5M
      mxEnvironment = mxFrameToEnvironment(mxFrame);
1078
51.5M
      mxFirstCode();
1079
51.5M
      mxBreak;
1080
51.5M
    mxCase(XS_CODE_RETURN)
1081
92.0k
      mxStack = mxFrameEnd;
1082
92.0k
      mxScope = mxFrame->value.frame.scope;
1083
92.0k
      mxCode = mxFrame->value.frame.code;
1084
92.0k
      mxAllocStack(1);
1085
92.0k
      *mxStack = *mxFrameResult;
1086
92.0k
      mxFrame = mxFrame->next;
1087
#ifdef mxTrace
1088
      if (gxDoTrace)
1089
        if (gxDoTrace) fxTraceReturn(the);
1090
#endif
1091
92.0k
      mxSaveState;
1092
92.0k
      return;
1093
      
1094
442k
    mxCase(XS_CODE_START_ASYNC)
1095
442k
      mxSkipCode(1);
1096
442k
      mxSaveState;
1097
442k
      variable = gxDefaults.newAsyncInstance(the);
1098
442k
      mxRestoreState;
1099
442k
      slot = mxFrameEnd;
1100
442k
      mxPushKind(XS_INTEGER_KIND);
1101
442k
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1102
442k
      mxPushKind(XS_INTEGER_KIND);
1103
442k
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1104
442k
      mxPushKind(XS_INTEGER_KIND);
1105
442k
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1106
442k
      mxPushKind(XS_INTEGER_KIND);
1107
442k
      mxStack->value.integer = 0;
1108
442k
      mxPushKind(mxFrameFunction->kind);
1109
442k
      mxStack->value = mxFrameFunction->value;
1110
442k
      index = mxPtrDiff(slot - mxStack);
1111
442k
      slot = variable->next;
1112
442k
      variable = slot->value.stack.address;
1113
442k
      if (slot->value.stack.length < index) {
1114
442k
        mxSaveState;
1115
442k
        if (variable)
1116
0
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1117
442k
        if (!variable)
1118
442k
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1119
442k
        mxRestoreState;
1120
442k
        slot->value.stack.address = variable;
1121
442k
      }
1122
442k
      slot->value.stack.length = index;
1123
442k
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1124
442k
      mxStack += 5;
1125
442k
      mxSaveState;
1126
442k
      gxDefaults.runAsync(the, mxStack->value.reference);
1127
442k
      mxRestoreState;
1128
442k
      slot = mxFrameResult;
1129
442k
      goto XS_CODE_END_ALL;
1130
      
1131
14.9k
    mxCase(XS_CODE_START_ASYNC_GENERATOR)
1132
14.9k
      mxSkipCode(1);
1133
14.9k
            if (mxFrameHasTarget)
1134
14.9k
        mxRunDebug(XS_TYPE_ERROR, "new: async generator");
1135
14.9k
      slot = mxBehaviorGetProperty(the, mxFrameFunction->value.reference, mxID(_prototype), 0, XS_ANY);
1136
14.9k
      mxPushKind(slot->kind);
1137
14.9k
      mxStack->value = slot->value;
1138
14.9k
      mxSaveState;
1139
14.9k
      variable = gxDefaults.newAsyncGeneratorInstance(the);
1140
14.9k
      mxRestoreState;
1141
14.9k
      mxFrameResult->kind = XS_UNINITIALIZED_KIND;
1142
14.9k
      slot = mxFrameEnd;
1143
14.9k
      mxPushKind(XS_INTEGER_KIND);
1144
14.9k
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1145
14.9k
      mxPushKind(XS_INTEGER_KIND);
1146
14.9k
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1147
14.9k
      mxPushKind(XS_INTEGER_KIND);
1148
14.9k
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1149
14.9k
      mxPushKind(XS_INTEGER_KIND);
1150
14.9k
      mxStack->value.integer = 0;
1151
14.9k
      mxPushKind(mxFrameFunction->kind);
1152
14.9k
      mxStack->value = mxFrameFunction->value;
1153
14.9k
      index = mxPtrDiff(slot - mxStack);
1154
14.9k
      slot = variable->next;
1155
14.9k
      variable = slot->value.stack.address;
1156
14.9k
      if (slot->value.stack.length < index) {
1157
14.9k
        mxSaveState;
1158
14.9k
        if (variable)
1159
0
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1160
14.9k
        if (!variable)
1161
14.9k
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1162
14.9k
        mxRestoreState;
1163
14.9k
        slot->value.stack.address = variable;
1164
14.9k
      }
1165
14.9k
      slot->value.stack.length = index;
1166
14.9k
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1167
14.9k
      mxStack += 5;
1168
14.9k
      *mxFrameResult = *(mxStack++);
1169
14.9k
      slot = mxFrameResult;
1170
14.9k
      goto XS_CODE_END_ALL;
1171
    
1172
2.14M
    mxCase(XS_CODE_START_GENERATOR)
1173
2.14M
      mxSkipCode(1);
1174
2.14M
            if (mxFrameHasTarget)
1175
2.14M
        mxRunDebug(XS_TYPE_ERROR, "new: generator");
1176
2.14M
      slot = mxBehaviorGetProperty(the, mxFrameFunction->value.reference, mxID(_prototype), 0, XS_ANY);
1177
2.14M
      mxPushKind(slot->kind);
1178
2.14M
      mxStack->value = slot->value;
1179
2.14M
      mxSaveState;
1180
2.14M
      variable = gxDefaults.newGeneratorInstance(the);
1181
2.14M
      mxRestoreState;
1182
2.14M
      slot = mxFrameEnd;
1183
2.14M
      mxPushKind(XS_INTEGER_KIND);
1184
2.14M
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1185
2.14M
      mxPushKind(XS_INTEGER_KIND);
1186
2.14M
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1187
2.14M
      mxPushKind(XS_INTEGER_KIND);
1188
2.14M
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1189
2.14M
      mxPushKind(XS_INTEGER_KIND);
1190
2.14M
      mxStack->value.integer = 0;
1191
2.14M
      mxPushKind(mxFrameFunction->kind);
1192
2.14M
      mxStack->value = mxFrameFunction->value;
1193
2.14M
      index = mxPtrDiff(slot - mxStack);
1194
2.14M
      slot = variable->next;
1195
2.14M
      variable = slot->value.stack.address;
1196
2.14M
      if (slot->value.stack.length < index) {
1197
2.14M
        mxSaveState;
1198
2.14M
        if (variable)
1199
0
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1200
2.14M
        if (!variable)
1201
2.14M
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1202
2.14M
        mxRestoreState;
1203
2.14M
        slot->value.stack.address = variable;
1204
2.14M
      }
1205
2.14M
      slot->value.stack.length = index;
1206
2.14M
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1207
2.14M
      mxStack += 5;
1208
2.14M
      *mxFrameResult = *(mxStack++);
1209
2.14M
      slot = mxFrameResult;
1210
2.14M
      goto XS_CODE_END_ALL;
1211
      
1212
97.6k
    mxCase(XS_CODE_AWAIT)
1213
358k
    mxCase(XS_CODE_YIELD)
1214
358k
    mxCase(XS_CODE_YIELD_STAR)
1215
358k
      generator->next->next->value.integer = byte;
1216
358k
      mxSkipCode(1);
1217
358k
      slot = mxFrameEnd;
1218
358k
      mxPushKind(XS_INTEGER_KIND);
1219
358k
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1220
358k
      mxPushKind(XS_INTEGER_KIND);
1221
358k
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1222
358k
      mxPushKind(XS_INTEGER_KIND);
1223
358k
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1224
358k
      jump = the->firstJump;
1225
358k
      offset = 0;
1226
358k
      while (jump != yieldJump) {
1227
47
        txJump* nextJump = jump->nextJump;
1228
47
        mxPushKind(XS_INTEGER_KIND);
1229
47
        mxStack->value.integer = mxPtrDiff(jump->code - mxFrameFunction->value.reference->next->value.code.address);
1230
47
        mxPushKind(XS_INTEGER_KIND);
1231
47
        mxStack->value.integer = mxPtrDiff(slot - jump->scope);
1232
47
        mxPushKind(XS_INTEGER_KIND);
1233
47
        mxStack->value.integer = mxPtrDiff(slot - jump->frame);
1234
47
        mxPushKind(XS_INTEGER_KIND);
1235
47
        mxStack->value.integer = mxPtrDiff(slot - jump->stack);
1236
47
        c_free(jump);
1237
47
        jump = nextJump;
1238
47
        offset++;
1239
47
      }
1240
358k
      the->firstJump = yieldJump;
1241
358k
      mxPushKind(XS_INTEGER_KIND);
1242
358k
      mxStack->value.integer = offset;
1243
358k
      mxPushKind(mxFrameFunction->kind);
1244
358k
      mxStack->value = mxFrameFunction->value;
1245
358k
      index = mxPtrDiff(slot - mxStack);
1246
358k
      slot = generator->next;
1247
358k
      variable = slot->value.stack.address;
1248
358k
      if (slot->value.stack.length < index) {
1249
269k
        mxSaveState;
1250
269k
        if (variable)
1251
269k
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1252
269k
        if (!variable)
1253
217k
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1254
269k
        mxRestoreState;
1255
269k
        slot->value.stack.address = variable;
1256
269k
      }
1257
358k
      slot->value.stack.length = index;
1258
358k
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1259
358k
      mxStack += 5 + (offset * 4);
1260
358k
      *mxFrameResult = *(mxStack++);
1261
358k
      slot = mxFrameResult;
1262
358k
      goto XS_CODE_END_ALL;
1263
      
1264
  /* FRAMES */    
1265
5.47M
    mxCase(XS_CODE_ARGUMENT)
1266
5.47M
      offset = mxRunU1(1);
1267
#ifdef mxTrace
1268
      if (gxDoTrace) fxTraceInteger(the, offset);
1269
#endif
1270
5.47M
      if (offset < mxFrameArgc) {
1271
4.84M
        slot = mxFrameArgv(offset);
1272
4.84M
        mxPushKind(slot->kind);
1273
4.84M
        mxStack->value = slot->value;
1274
4.84M
      }
1275
633k
      else {
1276
633k
        mxPushKind(XS_UNDEFINED_KIND);
1277
633k
      }
1278
5.47M
      mxNextCode(2);
1279
5.47M
      mxBreak;
1280
5.47M
    mxCase(XS_CODE_ARGUMENTS)
1281
97.5k
      offset = mxRunU1(1);
1282
#ifdef mxTrace
1283
      if (gxDoTrace) fxTraceInteger(the, offset);
1284
#endif
1285
97.5k
      mxSaveState;
1286
97.5k
      fxRunArguments(the, offset);
1287
97.5k
      mxRestoreState;
1288
97.5k
      mxNextCode(2);
1289
97.5k
      mxBreak;
1290
404k
    mxCase(XS_CODE_ARGUMENTS_SLOPPY)
1291
404k
      offset = mxRunU1(1);
1292
404k
      mxAllocStack(1);
1293
404k
      *mxStack = mxArgumentsSloppyPrototype;
1294
404k
      mxSaveState;
1295
404k
      gxDefaults.newArgumentsSloppyInstance(the, offset);
1296
404k
      mxRestoreState;
1297
404k
      mxNextCode(2);
1298
404k
      mxBreak;
1299
404k
    mxCase(XS_CODE_ARGUMENTS_STRICT)
1300
8.46k
      offset = mxRunU1(1);
1301
8.46k
      mxAllocStack(1);
1302
8.46k
      *mxStack = mxArgumentsStrictPrototype;
1303
8.46k
      mxSaveState;
1304
8.46k
      gxDefaults.newArgumentsStrictInstance(the, offset);
1305
8.46k
      mxRestoreState;
1306
8.46k
      mxNextCode(2);
1307
8.46k
      mxBreak;
1308
163k
    mxCase(XS_CODE_CURRENT)
1309
163k
      mxAllocStack(1);
1310
163k
      *mxStack = *mxFrameFunction;
1311
163k
      if (!(mxFrame->flag & XS_STRICT_FLAG))
1312
158k
        ignore = 1;
1313
163k
      mxNextCode(1);
1314
163k
      mxBreak;
1315
163k
    mxCase(XS_CODE_GET_RESULT)
1316
1.34k
      mxAllocStack(1);
1317
1.34k
      *mxStack = *mxFrameResult;
1318
1.34k
      mxNextCode(1);
1319
1.34k
      mxBreak;
1320
49.3M
    mxCase(XS_CODE_SET_RESULT)
1321
49.3M
      *mxFrameResult = *(mxStack++);
1322
49.3M
      mxNextCode(1);
1323
49.3M
      mxBreak;
1324
49.3M
    mxCase(XS_CODE_TARGET)
1325
3.75k
      mxAllocStack(1);
1326
3.75k
      if (mxFrameHasTarget)
1327
3.75k
        *mxStack = *mxFrameTarget;
1328
0
      else {
1329
0
        mxInitSlotKind(mxStack, XS_UNDEFINED_KIND);
1330
0
        mxStack->next = C_NULL;
1331
0
      }
1332
3.75k
      mxNextCode(1);
1333
3.75k
      mxBreak;
1334
2.39M
    mxCase(XS_CODE_THIS)
1335
2.39M
      mxAllocStack(1);
1336
2.39M
      *mxStack = *mxFrameThis;
1337
2.39M
      mxNextCode(1);
1338
2.39M
      mxBreak;
1339
2.39M
    mxCase(XS_CODE_GET_THIS)
1340
14
      slot = mxFrameThis;
1341
14
      variable = slot->value.closure;
1342
14
      if (variable->kind < 0)
1343
12
        mxRunDebug(XS_REFERENCE_ERROR, "this: not initialized yet");
1344
12
      mxPushKind(variable->kind);
1345
12
      mxStack->value = variable->value;
1346
12
      mxNextCode(1);
1347
12
      mxBreak;
1348
200
    mxCase(XS_CODE_SET_THIS)
1349
200
      slot = mxFrameThis;
1350
200
      variable = slot->value.closure;
1351
200
      if (variable->kind >= 0)
1352
200
        mxRunDebug(XS_REFERENCE_ERROR, "this: already initialized");
1353
200
      variable->kind = mxStack->kind;
1354
200
      variable->value = mxStack->value;
1355
200
      mxNextCode(1);
1356
200
      mxBreak;
1357
    
1358
  /* EXCEPTIONS */  
1359
1.39M
    mxCase(XS_CODE_EXCEPTION)
1360
1.39M
      mxAllocStack(1);
1361
1.39M
      *mxStack = mxException;
1362
1.39M
      mxException = mxUndefined;
1363
1.39M
      mxNextCode(1);
1364
1.39M
      mxBreak;
1365
1.39M
    mxCase(XS_CODE_CATCH_4)
1366
97.6k
      offset = mxRunS4(1);
1367
97.6k
      mxNextCode(5);
1368
97.6k
      goto XS_CODE_CATCH;
1369
1.61M
    mxCase(XS_CODE_CATCH_2)
1370
1.61M
      offset = mxRunS2(1);
1371
1.61M
      mxNextCode(3);
1372
1.61M
      goto XS_CODE_CATCH;
1373
1.24M
    mxCase(XS_CODE_CATCH_1)
1374
1.24M
      offset = mxRunS1(1);
1375
1.24M
      mxNextCode(2);
1376
2.95M
    XS_CODE_CATCH:
1377
2.95M
      jump = c_malloc(sizeof(txJump));
1378
2.95M
      if (jump) {
1379
2.95M
        jump->nextJump = the->firstJump;
1380
2.95M
        jump->stack = mxStack;
1381
2.95M
        jump->scope = mxScope;
1382
2.95M
        jump->frame = mxFrame;
1383
2.95M
        jump->environment = mxEnvironment->value.reference;
1384
2.95M
        jump->code = mxCode + offset;
1385
2.95M
        jump->flag = 1;
1386
2.95M
                the->firstJump = jump;
1387
2.95M
        if (c_setjmp(jump->buffer) != 0) {
1388
659k
          jump = the->firstJump;
1389
659k
                    the->firstJump = jump->nextJump;
1390
659k
          mxStack = jump->stack;
1391
659k
          mxScope = jump->scope;
1392
659k
          mxFrame = jump->frame;
1393
659k
          mxEnvironment = mxFrameToEnvironment(mxFrame);
1394
659k
          mxEnvironment->value.reference = jump->environment;
1395
659k
          mxCode = jump->code;
1396
659k
          c_free(jump);
1397
659k
          mxFirstCode();
1398
659k
        }
1399
2.95M
      }
1400
0
      else {
1401
0
        mxSaveState;
1402
0
        fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
1403
0
      }
1404
2.95M
      mxBreak;
1405
2.95M
    mxCase(XS_CODE_RETHROW)
1406
0
      mxSaveState;
1407
0
      fxJump(the);
1408
0
      mxBreak;
1409
395k
    mxCase(XS_CODE_THROW)
1410
395k
      mxException = *mxStack;
1411
395k
    #ifdef mxDebug
1412
395k
      mxSaveState;
1413
395k
      fxDebugThrow(the, C_NULL, 0, "throw");
1414
395k
      mxRestoreState;
1415
    #elif mxInstrument
1416
      mxSaveState;
1417
      fxTraceException(the);
1418
      mxRestoreState;
1419
    #endif
1420
395k
      mxSaveState;
1421
395k
      fxJump(the);
1422
0
      mxBreak;
1423
18
    mxCase(XS_CODE_THROW_STATUS)
1424
18
      if (the->status & XS_THROW_STATUS) {
1425
3
        mxException = *mxStack;
1426
3
      #ifdef mxDebug
1427
3
        mxSaveState;
1428
3
        fxDebugThrow(the, C_NULL, 0, "throw");
1429
3
        mxRestoreState;
1430
      #elif mxInstrument
1431
        mxSaveState;
1432
        fxTraceException(the);
1433
        mxRestoreState;
1434
      #endif
1435
3
        mxSaveState;
1436
3
        fxJump(the);
1437
3
      }
1438
15
      mxNextCode(1);
1439
15
      mxBreak;
1440
2.28M
    mxCase(XS_CODE_UNCATCH)
1441
2.28M
      jump = the->firstJump;
1442
2.28M
      the->firstJump = jump->nextJump;
1443
2.28M
      c_free(jump);
1444
2.28M
      mxNextCode(1);
1445
2.28M
      mxBreak;
1446
      
1447
  /* BRANCHES */  
1448
26.5M
    mxCase(XS_CODE_BRANCH_1)
1449
26.5M
      offset = mxRunS1(1);
1450
26.5M
      mxBranch(2, offset);
1451
26.5M
      mxBreak;
1452
26.5M
    mxCase(XS_CODE_BRANCH_2)
1453
17.4M
      offset = mxRunS2(1);
1454
17.4M
      mxBranch(3, offset);
1455
17.4M
      mxBreak;
1456
17.4M
    mxCase(XS_CODE_BRANCH_4)
1457
377k
      offset = mxRunS4(1);
1458
377k
      mxBranch(5, offset);
1459
377k
      mxBreak;
1460
377k
    mxCase(XS_CODE_BRANCH_CHAIN_4)
1461
0
      offset = mxRunS4(1);
1462
0
      index = 5;
1463
0
      goto XS_CODE_BRANCH_CHAIN;
1464
1.37k
    mxCase(XS_CODE_BRANCH_CHAIN_2)
1465
1.37k
      offset = mxRunS2(1);
1466
1.37k
      index = 3;
1467
1.37k
      goto XS_CODE_BRANCH_CHAIN;
1468
25.8k
    mxCase(XS_CODE_BRANCH_CHAIN_1)
1469
25.8k
      offset = mxRunS1(1);
1470
25.8k
      index = 2;
1471
27.1k
    XS_CODE_BRANCH_CHAIN:
1472
27.1k
      byte = mxStack->kind;
1473
27.1k
      if ((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte)) {
1474
18.0k
        mxStack->kind = XS_UNDEFINED_KIND;
1475
18.0k
        mxBranch(index, offset);
1476
18.0k
      }
1477
9.10k
      else
1478
9.10k
        mxNextCode((txS4)index);
1479
27.1k
      mxBreak;
1480
67.2k
    mxCase(XS_CODE_BRANCH_COALESCE_4)
1481
67.2k
      offset = mxRunS4(1);
1482
67.2k
      index = 5;
1483
67.2k
      goto XS_CODE_BRANCH_COALESCE;
1484
3.27M
    mxCase(XS_CODE_BRANCH_COALESCE_2)
1485
3.27M
      offset = mxRunS2(1);
1486
3.27M
      index = 3;
1487
3.27M
      goto XS_CODE_BRANCH_COALESCE;
1488
825k
    mxCase(XS_CODE_BRANCH_COALESCE_1)
1489
825k
      offset = mxRunS1(1);
1490
825k
      index = 2;
1491
4.16M
    XS_CODE_BRANCH_COALESCE:
1492
4.16M
      byte = mxStack->kind;
1493
4.16M
      if ((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte)) {
1494
4.55k
        mxStack++;
1495
4.55k
        mxNextCode((txS4)index);
1496
4.55k
      }
1497
4.16M
      else {
1498
4.16M
        mxBranch(index, offset);
1499
4.16M
      }
1500
4.16M
      mxBreak;
1501
4.16M
    mxCase(XS_CODE_BRANCH_ELSE_4)
1502
351k
      offset = mxRunS4(1);
1503
351k
      index = 5;
1504
351k
      goto XS_CODE_BRANCH_ELSE;
1505
9.69M
    mxCase(XS_CODE_BRANCH_ELSE_2)
1506
9.69M
      offset = mxRunS2(1);
1507
9.69M
      index = 3;
1508
9.69M
      goto XS_CODE_BRANCH_ELSE;
1509
28.3M
    mxCase(XS_CODE_BRANCH_ELSE_1)
1510
28.3M
      offset = mxRunS1(1);
1511
28.3M
      index = 2;
1512
38.3M
    XS_CODE_BRANCH_ELSE:
1513
38.3M
      byte = mxStack->kind;
1514
38.3M
      if (XS_BOOLEAN_KIND == byte) {
1515
17.7M
        mxBranchElse(mxStack->value.boolean, index, offset);
1516
17.7M
      }
1517
20.6M
      else if (XS_INTEGER_KIND == byte) {
1518
13.6M
        mxBranchElse(mxStack->value.integer, index, offset);
1519
13.6M
      }
1520
6.97M
      else if (XS_NUMBER_KIND == byte) {
1521
2.66M
        mxBranchIf((c_isnan(mxStack->value.number) || c_iszero(mxStack->value.number)), index, offset);
1522
2.66M
        mxFloatingPointOp("else");
1523
2.66M
      }
1524
4.30M
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte)) {
1525
1.05M
        mxBranchIf(((mxStack->value.bigint.size == 1) && (mxStack->value.bigint.data[0] == 0)), index, offset);
1526
1.05M
      }
1527
3.25M
      else if ((XS_STRING_KIND == byte) || (XS_STRING_X_KIND == byte)) {
1528
1.55M
        mxBranchIf(c_isEmpty(mxStack->value.string), index, offset);
1529
1.55M
      }
1530
1.70M
      else {
1531
1.70M
        mxBranchIf((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte), index, offset);
1532
1.70M
      }
1533
38.3M
      mxStack++;
1534
38.3M
      mxBreak;
1535
38.3M
    mxCase(XS_CODE_BRANCH_IF_4)
1536
199k
      offset = mxRunS4(1);
1537
199k
      index = 5;
1538
199k
      goto XS_CODE_BRANCH_IF;
1539
8.21M
    mxCase(XS_CODE_BRANCH_IF_2)
1540
8.21M
      offset = mxRunS2(1);
1541
8.21M
      index = 3;
1542
8.21M
      goto XS_CODE_BRANCH_IF;
1543
7.97M
    mxCase(XS_CODE_BRANCH_IF_1)
1544
7.97M
      offset = mxRunS1(1);
1545
7.97M
      index = 2;
1546
16.3M
    XS_CODE_BRANCH_IF:
1547
16.3M
      byte = mxStack->kind;
1548
16.3M
      if (XS_BOOLEAN_KIND == byte) {
1549
9.53M
        mxBranchIf(mxStack->value.boolean, index, offset);
1550
9.53M
      }
1551
6.86M
      else if (XS_INTEGER_KIND == byte) {
1552
4.51M
        mxBranchIf(mxStack->value.integer, index, offset);
1553
4.51M
      }
1554
2.34M
      else if (XS_NUMBER_KIND == byte) {
1555
1.37M
        mxBranchElse(c_isnan(mxStack->value.number) || c_iszero(mxStack->value.number), index, offset);
1556
1.37M
        mxFloatingPointOp("if");
1557
1.37M
      }
1558
968k
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte)) {
1559
3.00k
        mxBranchElse((mxStack->value.bigint.size == 1) && (mxStack->value.bigint.data[0] == 0), index, offset);
1560
3.00k
      }
1561
965k
      else if ((XS_STRING_KIND == byte) || (XS_STRING_X_KIND == byte)) {
1562
463k
        mxBranchElse(c_isEmpty(mxStack->value.string), index, offset);
1563
463k
      }
1564
501k
      else {
1565
501k
        mxBranchElse((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte), index, offset);
1566
501k
      }
1567
16.3M
      mxStack++;
1568
16.3M
      mxBreak;
1569
16.3M
    mxCase(XS_CODE_BRANCH_STATUS_4)
1570
0
      offset = mxRunS4(1);
1571
0
      index = 5;
1572
0
      goto XS_CODE_BRANCH_STATUS;
1573
17.3k
    mxCase(XS_CODE_BRANCH_STATUS_2)
1574
17.3k
      offset = mxRunS2(1);
1575
17.3k
      index = 3;
1576
17.3k
      goto XS_CODE_BRANCH_STATUS;
1577
296k
    mxCase(XS_CODE_BRANCH_STATUS_1)
1578
296k
      offset = mxRunS1(1);
1579
296k
      index = 2;
1580
314k
    XS_CODE_BRANCH_STATUS:
1581
314k
      if (the->status & XS_THROW_STATUS) {
1582
2
        mxException = *mxStack;
1583
2
      #ifdef mxDebug
1584
2
        mxSaveState;
1585
2
        fxDebugThrow(the, C_NULL, 0, "throw");
1586
2
        mxRestoreState;
1587
      #elif mxInstrument
1588
        mxSaveState;
1589
        fxTraceException(the);
1590
        mxRestoreState;
1591
      #endif
1592
2
        mxSaveState;
1593
2
        fxJump(the);
1594
2
      }
1595
314k
      mxNextCode((the->status & XS_RETURN_STATUS) ? index : index + offset);
1596
314k
      mxBreak;
1597
      
1598
  /* STACK */  
1599
63.2M
    mxCase(XS_CODE_DUB)
1600
63.2M
      mxAllocStack(1);
1601
63.2M
      *mxStack = *(mxStack + 1);
1602
63.2M
      mxNextCode(1);
1603
63.2M
      mxBreak;
1604
63.2M
    mxCase(XS_CODE_DUB_AT)
1605
1.57M
      mxAllocStack(2);
1606
1.57M
      *(mxStack + 1) = *(mxStack + 3);
1607
1.57M
      *mxStack = *(mxStack + 2);
1608
1.57M
      mxNextCode(1);
1609
1.57M
      mxBreak;
1610
83.1M
    mxCase(XS_CODE_POP)
1611
83.1M
      mxStack++;
1612
83.1M
      mxNextCode(1);
1613
83.1M
      mxBreak;
1614
83.1M
    mxCase(XS_CODE_SWAP)
1615
3.81k
      scratch = *(mxStack);
1616
3.81k
      *(mxStack) = *(mxStack + 1);
1617
3.81k
      *(mxStack + 1) = scratch;
1618
3.81k
      mxNextCode(1);
1619
3.81k
      mxBreak;
1620
1621
  /* SCOPE */    
1622
3.81k
    mxCase(XS_CODE_CONST_CLOSURE_2)
1623
0
      index = mxRunU2(1);
1624
0
      mxNextCode(3);
1625
0
      goto XS_CODE_CONST_CLOSURE;
1626
208k
    mxCase(XS_CODE_CONST_CLOSURE_1)
1627
208k
      index = mxRunU1(1);
1628
208k
      mxNextCode(2);
1629
208k
    XS_CODE_CONST_CLOSURE:
1630
#ifdef mxTrace
1631
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1632
#endif
1633
208k
      slot = mxEnvironment - index;
1634
208k
      variable = slot->value.closure;
1635
208k
      if (variable->kind >= 0)
1636
205k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: already initialized", slot->ID);
1637
//      slot->flag |= XS_DONT_SET_FLAG; //@@
1638
205k
      variable->flag |= XS_DONT_SET_FLAG;
1639
205k
      variable->kind = mxStack->kind;
1640
205k
      variable->value = mxStack->value;
1641
205k
      if (!(mxFrame->flag & XS_STRICT_FLAG) && ignore) {
1642
21.5k
        ignore = 0;
1643
21.5k
        variable->flag |= XS_DONT_ENUM_FLAG;
1644
21.5k
      }
1645
205k
      mxBreak;
1646
211k
    mxCase(XS_CODE_CONST_LOCAL_2)
1647
211k
      index = mxRunU2(1);
1648
211k
      mxNextCode(3);
1649
211k
      goto XS_CODE_CONST_LOCAL;
1650
3.35M
    mxCase(XS_CODE_CONST_LOCAL_1)
1651
3.35M
      index = mxRunU1(1);
1652
3.35M
      mxNextCode(2);
1653
3.56M
    XS_CODE_CONST_LOCAL:
1654
#ifdef mxTrace
1655
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1656
#endif
1657
3.56M
      variable = mxEnvironment - index;
1658
3.56M
      if (variable->kind >= 0)
1659
3.56M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: already initialized", variable->ID);
1660
3.56M
      variable->flag |= XS_DONT_SET_FLAG;
1661
3.56M
      variable->kind = mxStack->kind;
1662
3.56M
      variable->value = mxStack->value;
1663
3.56M
      if (!(mxFrame->flag & XS_STRICT_FLAG) && ignore) {
1664
131k
        ignore = 0;
1665
131k
        variable->flag |= XS_DONT_ENUM_FLAG;
1666
131k
      }
1667
3.56M
      mxBreak;
1668
            
1669
3.56M
    mxCase(XS_CODE_GET_CLOSURE_2)
1670
0
      index = mxRunU2(1);
1671
0
      mxNextCode(3);
1672
0
      goto XS_CODE_GET_CLOSURE;
1673
7.14M
    mxCase(XS_CODE_GET_CLOSURE_1)
1674
7.14M
      index = mxRunU1(1);
1675
7.14M
      mxNextCode(2);
1676
7.14M
    XS_CODE_GET_CLOSURE:
1677
#ifdef mxTrace
1678
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1679
#endif
1680
7.14M
      slot = mxEnvironment - index;
1681
7.14M
      #ifdef mxDebug
1682
7.14M
        offset = slot->ID;
1683
7.14M
      #endif
1684
7.14M
      variable = slot->value.closure;
1685
7.14M
      if (variable->kind < 0)
1686
7.10M
        mxRunDebugID(XS_REFERENCE_ERROR, "get %s: not initialized yet", slot->ID);
1687
#if mxAliasInstance
1688
      offset = variable->ID;
1689
      if (offset) {
1690
        slot = the->aliasArray[offset];
1691
        if (slot)
1692
          variable = slot;
1693
      } 
1694
#endif
1695
7.10M
      mxPushKind(variable->kind);
1696
7.10M
      mxStack->value = variable->value;
1697
7.10M
      mxBreak;
1698
7.10M
    mxCase(XS_CODE_GET_LOCAL_2)
1699
1.89M
      index = mxRunU2(1);
1700
1.89M
      mxNextCode(3);
1701
1.89M
      goto XS_CODE_GET_LOCAL;
1702
56.9M
    mxCase(XS_CODE_GET_LOCAL_1)
1703
56.9M
      index = mxRunU1(1);
1704
56.9M
      mxNextCode(2);
1705
58.8M
    XS_CODE_GET_LOCAL:
1706
#ifdef mxTrace
1707
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1708
#endif
1709
58.8M
      variable = mxEnvironment - index;
1710
58.8M
      #ifdef mxDebug
1711
58.8M
        offset = variable->ID;
1712
58.8M
      #endif
1713
58.8M
      if (variable->kind < 0)
1714
58.8M
        mxRunDebugID(XS_REFERENCE_ERROR, "get %s: not initialized yet", variable->ID);
1715
58.8M
      mxPushKind(variable->kind);
1716
58.8M
      mxStack->value = variable->value;
1717
58.8M
      mxBreak;
1718
      
1719
58.8M
    mxCase(XS_CODE_LET_CLOSURE_2)
1720
0
      index = mxRunU2(1);
1721
0
      mxNextCode(3);
1722
0
      goto XS_CODE_LET_CLOSURE;
1723
163k
    mxCase(XS_CODE_LET_CLOSURE_1)
1724
163k
      index = mxRunU1(1);
1725
163k
      mxNextCode(2);
1726
163k
    XS_CODE_LET_CLOSURE:
1727
#ifdef mxTrace
1728
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1729
#endif
1730
163k
      slot = mxEnvironment - index;
1731
163k
      variable = slot->value.closure;
1732
163k
      variable->kind = mxStack->kind;
1733
163k
      variable->value = mxStack->value;
1734
163k
      mxBreak;
1735
163k
    mxCase(XS_CODE_LET_LOCAL_2)
1736
0
      index = mxRunU2(1);
1737
0
      mxNextCode(3);
1738
0
      goto XS_CODE_LET_LOCAL;
1739
1.13M
    mxCase(XS_CODE_LET_LOCAL_1)
1740
1.13M
      index = mxRunU1(1);
1741
1.13M
      mxNextCode(2);
1742
1.13M
    XS_CODE_LET_LOCAL:
1743
#ifdef mxTrace
1744
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1745
#endif
1746
1.13M
      variable = mxEnvironment - index;
1747
1.13M
      variable->kind = mxStack->kind;
1748
1.13M
      variable->value = mxStack->value;
1749
1.13M
      mxBreak;
1750
      
1751
1.33M
    mxCase(XS_CODE_NEW_CLOSURE)
1752
1.33M
      offset = mxRunID(1);
1753
#ifdef mxTrace
1754
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
1755
#endif
1756
1.33M
      mxNextCode(1 + sizeof(txID));
1757
1.33M
      slot = --mxScope;
1758
#ifdef mxTrace
1759
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1760
#endif
1761
1.33M
      mxSaveState;
1762
1.33M
      variable = fxNewSlot(the);
1763
1.33M
      mxRestoreState;
1764
1.33M
      slot->flag = XS_DONT_DELETE_FLAG;
1765
1.33M
      slot->ID = (txID)offset;
1766
1.33M
      slot->kind = XS_CLOSURE_KIND;
1767
1.33M
      slot->value.closure = variable;
1768
1.33M
      variable->kind = XS_UNINITIALIZED_KIND;
1769
1.33M
      mxBreak;
1770
10.7M
    mxCase(XS_CODE_NEW_LOCAL)
1771
10.7M
      offset = mxRunID(1);
1772
#ifdef mxTrace
1773
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
1774
#endif
1775
10.7M
      mxNextCode(1 + sizeof(txID));
1776
10.7M
      variable = --mxScope;
1777
#ifdef mxTrace
1778
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1779
#endif
1780
10.7M
      variable->flag = XS_DONT_DELETE_FLAG;
1781
10.7M
      variable->ID = (txID)offset;
1782
10.7M
      variable->kind = XS_UNINITIALIZED_KIND;
1783
10.7M
      mxBreak;
1784
34.6M
    mxCase(XS_CODE_NEW_TEMPORARY)
1785
34.6M
      variable = --mxScope;
1786
#ifdef mxTrace
1787
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1788
#endif
1789
34.6M
      mxInitSlotKind(variable, XS_UNDEFINED_KIND);
1790
34.6M
      mxNextCode(1);
1791
34.6M
      mxBreak;
1792
      
1793
34.6M
    mxCase(XS_CODE_PULL_CLOSURE_2)
1794
0
      index = mxRunU2(1);
1795
0
      mxNextCode(3);
1796
0
      goto XS_CODE_PULL_CLOSURE;
1797
833k
    mxCase(XS_CODE_PULL_CLOSURE_1)
1798
833k
      index = mxRunU1(1);
1799
833k
      mxNextCode(2);
1800
833k
    XS_CODE_PULL_CLOSURE:
1801
#ifdef mxTrace
1802
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1803
#endif
1804
833k
      slot = mxEnvironment - index;
1805
833k
      if (slot->flag & XS_DONT_SET_FLAG) // import
1806
833k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1807
833k
      variable = slot->value.closure;
1808
833k
      if (variable->kind < 0)
1809
833k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", slot->ID);
1810
833k
      if (variable->flag & XS_DONT_SET_FLAG) {
1811
48.0k
        if (variable->flag & XS_DONT_ENUM_FLAG) {
1812
48.0k
          mxStack++;
1813
48.0k
          mxBreak;
1814
48.0k
        }
1815
48.0k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1816
0
      }
1817
#if mxAliasInstance
1818
      offset = variable->ID;
1819
      if (offset) {
1820
        variable = the->aliasArray[offset];
1821
        if (!variable) {
1822
          mxSaveState;
1823
          variable = fxNewSlot(the);
1824
          mxRestoreState;
1825
          the->aliasArray[offset] = variable;
1826
        }
1827
      } 
1828
#endif
1829
785k
      variable->kind = mxStack->kind;
1830
785k
      variable->value = mxStack->value;
1831
785k
      mxStack++;
1832
785k
      mxBreak;
1833
1.67M
    mxCase(XS_CODE_PULL_LOCAL_2)
1834
1.67M
      index = mxRunU2(1);
1835
1.67M
      mxNextCode(3);
1836
1.67M
      goto XS_CODE_PULL_LOCAL;
1837
21.2M
    mxCase(XS_CODE_PULL_LOCAL_1)
1838
21.2M
      index = mxRunU1(1);
1839
21.2M
      mxNextCode(2);
1840
22.8M
    XS_CODE_PULL_LOCAL:
1841
#ifdef mxTrace
1842
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1843
#endif
1844
22.8M
      variable = mxEnvironment - index;
1845
22.8M
      if (variable->kind < 0)
1846
22.8M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", variable->ID);
1847
22.8M
      if (variable->flag & XS_DONT_SET_FLAG) {
1848
1.14k
        if (variable->flag & XS_DONT_ENUM_FLAG) {
1849
1.14k
          mxStack++;
1850
1.14k
          mxBreak;
1851
1.14k
        }
1852
1.14k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", variable->ID);
1853
0
      }
1854
22.8M
      variable->kind = mxStack->kind;
1855
22.8M
      variable->value = mxStack->value;
1856
22.8M
      mxStack++;
1857
22.8M
      mxBreak;
1858
      
1859
22.8M
    mxCase(XS_CODE_REFRESH_CLOSURE_2)
1860
0
      index = mxRunU2(1);
1861
0
      mxNextCode(3);
1862
0
      goto XS_CODE_REFRESH_CLOSURE;
1863
79.9k
    mxCase(XS_CODE_REFRESH_CLOSURE_1)
1864
79.9k
      index = mxRunU1(1);
1865
79.9k
      mxNextCode(2);
1866
79.9k
    XS_CODE_REFRESH_CLOSURE:
1867
#ifdef mxTrace
1868
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1869
#endif
1870
79.9k
      variable = mxEnvironment - index;
1871
79.9k
      mxSaveState;
1872
79.9k
      slot = fxNewSlot(the);
1873
79.9k
      mxRestoreState;
1874
79.9k
      slot->flag = variable->value.closure->flag;
1875
79.9k
      slot->kind = variable->value.closure->kind;
1876
79.9k
      slot->value = variable->value.closure->value;
1877
79.9k
      variable->value.closure = slot;
1878
79.9k
      mxBreak;
1879
79.9k
    mxCase(XS_CODE_REFRESH_LOCAL_2)
1880
0
      index = mxRunU2(1);
1881
0
      mxNextCode(3);
1882
0
      goto XS_CODE_REFRESH_LOCAL;
1883
1.41M
    mxCase(XS_CODE_REFRESH_LOCAL_1)
1884
1.41M
      index = mxRunU1(1);
1885
1.41M
      mxNextCode(2);
1886
1.41M
    XS_CODE_REFRESH_LOCAL:
1887
#ifdef mxTrace
1888
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1889
#endif
1890
1.41M
      variable = mxEnvironment - index;
1891
1.41M
      mxBreak;
1892
      
1893
1.41M
    mxCase(XS_CODE_RESERVE_2)
1894
8.73k
      index = mxRunU2(1);
1895
8.73k
      mxNextCode(3);
1896
8.73k
      goto XS_CODE_RESERVE;
1897
6.86M
    mxCase(XS_CODE_RESERVE_1)
1898
6.86M
      index = mxRunU1(1);
1899
6.86M
      mxNextCode(2);
1900
6.86M
    XS_CODE_RESERVE:
1901
#ifdef mxTrace
1902
      if (gxDoTrace) fxTraceIndex(the, index);
1903
#endif
1904
6.86M
      mxAllocStack(index);    
1905
6.86M
      c_memset(mxStack, 0, index * sizeof(txSlot));
1906
6.86M
      mxBreak;
1907
      
1908
6.86M
    mxCase(XS_CODE_RESET_CLOSURE_2)
1909
0
      index = mxRunU2(1);
1910
0
      mxNextCode(3);
1911
0
      goto XS_CODE_RESET_CLOSURE;
1912
750
    mxCase(XS_CODE_RESET_CLOSURE_1)
1913
750
      index = mxRunU1(1);
1914
750
      mxNextCode(2);
1915
750
    XS_CODE_RESET_CLOSURE:
1916
#ifdef mxTrace
1917
      if (gxDoTrace) fxTraceIndex(the, index);
1918
#endif
1919
750
      slot = mxEnvironment - index;
1920
750
      mxSaveState;
1921
750
      variable = fxNewSlot(the);
1922
750
      mxRestoreState;
1923
750
      variable->kind = XS_UNINITIALIZED_KIND;
1924
750
      slot->value.closure = variable;
1925
750
      mxBreak;
1926
211k
    mxCase(XS_CODE_RESET_LOCAL_2)
1927
211k
      index = mxRunU2(1);
1928
211k
      mxNextCode(3);
1929
211k
      goto XS_CODE_RESET_LOCAL;
1930
989k
    mxCase(XS_CODE_RESET_LOCAL_1)
1931
989k
      index = mxRunU1(1);
1932
989k
      mxNextCode(2);
1933
1.20M
    XS_CODE_RESET_LOCAL:
1934
#ifdef mxTrace
1935
      if (gxDoTrace) fxTraceIndex(the, index);
1936
#endif
1937
1.20M
      variable = mxEnvironment - index;
1938
1.20M
      variable->flag = XS_NO_FLAG;
1939
1.20M
      variable->kind = XS_UNINITIALIZED_KIND;
1940
1.20M
      mxBreak;
1941
      
1942
1.20M
    mxCase(XS_CODE_SET_CLOSURE_2)
1943
0
      index = mxRunU2(1);
1944
0
      mxNextCode(3);
1945
0
      goto XS_CODE_SET_CLOSURE;
1946
849k
    mxCase(XS_CODE_SET_CLOSURE_1)
1947
849k
      index = mxRunU1(1);
1948
849k
      mxNextCode(2);
1949
849k
    XS_CODE_SET_CLOSURE:
1950
#ifdef mxTrace
1951
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1952
#endif
1953
849k
      slot = mxEnvironment - index;
1954
849k
      if (slot->flag & XS_DONT_SET_FLAG) // import
1955
849k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1956
849k
      variable = slot->value.closure;
1957
849k
      if (variable->kind < 0)
1958
849k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", slot->ID);
1959
849k
      if (variable->flag & XS_DONT_SET_FLAG) {
1960
52.7k
        if (variable->flag & XS_DONT_ENUM_FLAG)
1961
52.0k
          mxBreak;
1962
52.7k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1963
0
      }
1964
#if mxAliasInstance
1965
      offset = variable->ID;
1966
      if (offset > 0) {
1967
        variable = the->aliasArray[offset];
1968
        if (!variable) {
1969
          mxSaveState;
1970
          variable = fxNewSlot(the);
1971
          mxRestoreState;
1972
          the->aliasArray[offset] = variable;
1973
        }
1974
      } 
1975
#endif
1976
796k
      variable->kind = mxStack->kind;
1977
796k
      variable->value = mxStack->value;
1978
796k
      mxBreak;
1979
1.33M
    mxCase(XS_CODE_SET_LOCAL_2)
1980
1.33M
      index = mxRunU2(1);
1981
1.33M
      mxNextCode(3);
1982
1.33M
      goto XS_CODE_SET_LOCAL;
1983
30.7M
    mxCase(XS_CODE_SET_LOCAL_1)
1984
30.7M
      index = mxRunU1(1);
1985
30.7M
      mxNextCode(2);
1986
32.1M
    XS_CODE_SET_LOCAL:
1987
#ifdef mxTrace
1988
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1989
#endif
1990
32.1M
      variable = mxEnvironment - index;
1991
32.1M
      if (variable->kind < 0)
1992
32.1M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", variable->ID);
1993
32.1M
      if (variable->flag & XS_DONT_SET_FLAG) {
1994
34.9k
        if (variable->flag & XS_DONT_ENUM_FLAG)
1995
34.0k
          mxBreak;
1996
34.9k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", variable->ID);
1997
0
      }
1998
32.0M
      variable->kind = mxStack->kind;
1999
32.0M
      variable->value = mxStack->value;
2000
32.0M
      mxBreak;
2001
2002
32.0M
    mxCase(XS_CODE_VAR_CLOSURE_2)
2003
310
      index = mxRunU2(1);
2004
310
      mxNextCode(3);
2005
310
      goto XS_CODE_VAR_CLOSURE;
2006
1.09M
    mxCase(XS_CODE_VAR_CLOSURE_1)
2007
1.09M
      index = mxRunU1(1);
2008
1.09M
      mxNextCode(2);
2009
1.09M
    XS_CODE_VAR_CLOSURE:
2010
#ifdef mxTrace
2011
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2012
#endif
2013
1.09M
      variable = (mxEnvironment - index)->value.closure;
2014
1.09M
      variable->kind = mxStack->kind;
2015
1.09M
      variable->value = mxStack->value;
2016
1.09M
      mxBreak;
2017
1.09M
    mxCase(XS_CODE_VAR_LOCAL_2)
2018
0
      index = mxRunU2(1);
2019
0
      mxNextCode(3);
2020
0
      goto XS_CODE_VAR_LOCAL;
2021
7.62M
    mxCase(XS_CODE_VAR_LOCAL_1)
2022
7.62M
      index = mxRunU1(1);
2023
7.62M
      mxNextCode(2);
2024
7.62M
    XS_CODE_VAR_LOCAL:
2025
#ifdef mxTrace
2026
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2027
#endif
2028
7.62M
      variable = mxEnvironment - index;
2029
7.62M
      variable->kind = mxStack->kind;
2030
7.62M
      variable->value = mxStack->value;
2031
7.62M
      mxBreak;
2032
      
2033
7.62M
    mxCase(XS_CODE_UNWIND_2)
2034
0
      index = mxRunU2(1);
2035
0
      mxNextCode(3);
2036
0
      goto XS_CODE_UNWIND;
2037
19.2M
    mxCase(XS_CODE_UNWIND_1)
2038
19.2M
      index = mxRunU1(1);
2039
19.2M
      mxNextCode(2);
2040
19.2M
    XS_CODE_UNWIND:
2041
#ifdef mxTrace
2042
      if (gxDoTrace) fxTraceIndex(the, index);
2043
#endif
2044
19.2M
      slot = mxScope;
2045
19.2M
      mxScope += index;
2046
48.7M
      while (slot < mxScope)
2047
29.5M
        (slot++)->kind = XS_UNDEFINED_KIND;
2048
19.2M
      mxBreak;
2049
      
2050
19.2M
    mxCase(XS_CODE_RETRIEVE_2)
2051
0
      index = mxRunU2(1);
2052
0
      mxNextCode(3);
2053
0
      goto XS_CODE_RETRIEVE;
2054
3.10M
    mxCase(XS_CODE_RETRIEVE_1)
2055
3.10M
      index = mxRunU1(1);
2056
3.10M
      mxNextCode(2);
2057
3.10M
    XS_CODE_RETRIEVE:
2058
#ifdef mxTrace
2059
      if (gxDoTrace) fxTraceIndex(the, index);
2060
#endif
2061
3.10M
      slot = mxEnvironment->value.reference->next->next;
2062
3.10M
      variable = mxScope;
2063
7.56M
      while (index) {
2064
4.45M
        --variable;
2065
4.45M
        offset = variable->ID = slot->ID;
2066
4.45M
                variable->flag = slot->flag;
2067
4.45M
                variable->kind = slot->kind;
2068
4.45M
        variable->value = slot->value;
2069
#ifdef mxTrace
2070
        if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2071
#endif
2072
4.45M
        index--;
2073
4.45M
        slot = slot->next;
2074
4.45M
      }
2075
3.10M
      mxScope = variable;
2076
3.10M
      mxBreak;
2077
3.10M
    mxCase(XS_CODE_RETRIEVE_TARGET)
2078
372k
      if (mxID(_new_target) == slot->ID) {
2079
3
        if (!mxFrameHasTarget) {
2080
3
          mxAllocStack(1);
2081
3
          c_memmove(mxStack, mxStack + 1, (mxFrame + 3 - mxStack) * sizeof(txSlot));
2082
3
          mxScope--;
2083
3
          mxEnvironment--;
2084
3
          mxFrame--;
2085
3
          mxFrame->flag |= XS_TARGET_FLAG;
2086
3
        }
2087
3
        variable = mxFrameTarget;
2088
3
        variable->kind = slot->kind;
2089
3
        variable->value = slot->value;
2090
2091
3
        slot = slot->next;
2092
3
      }
2093
372k
      mxNextCode(1);
2094
372k
      mxBreak;
2095
372k
    mxCase(XS_CODE_RETRIEVE_THIS)
2096
372k
      variable = mxFrameThis;
2097
372k
      variable->kind = slot->kind;
2098
372k
      variable->value = slot->value;
2099
372k
      slot = slot->next;
2100
372k
      mxNextCode(1);
2101
372k
      mxBreak;
2102
      
2103
1.17M
    mxCase(XS_CODE_ENVIRONMENT) 
2104
1.17M
      mxPushKind(XS_UNDEFINED_KIND);
2105
1.17M
      mxSaveState;
2106
1.17M
      slot = fxNewEnvironmentInstance(the, C_NULL);
2107
1.17M
      mxRestoreState;
2108
1.17M
      variable = mxFunctionInstanceCode((mxStack + 1)->value.reference);
2109
1.17M
      variable->value.code.closures = slot;
2110
1.17M
      mxNextCode(1);
2111
1.17M
      mxBreak;
2112
2113
1.17M
    mxCase(XS_CODE_STORE_2)
2114
310
      index = mxRunU2(1);
2115
310
      mxNextCode(3);
2116
310
      goto XS_CODE_STORE;
2117
2.12M
    mxCase(XS_CODE_STORE_1)
2118
2.12M
      index = mxRunU1(1);
2119
2.12M
      mxNextCode(2);
2120
2.12M
    XS_CODE_STORE:
2121
#ifdef mxTrace
2122
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2123
#endif
2124
2.12M
      address = &(mxStack->value.reference->next);
2125
5.95M
      while ((slot = *address)) {
2126
3.83M
        address = &slot->next;
2127
3.83M
      }
2128
2.12M
      mxSaveState;
2129
2.12M
      *address = slot = fxNewSlot(the);
2130
2.12M
      mxRestoreState;
2131
2.12M
      variable = mxEnvironment - index;
2132
2.12M
      offset = slot->ID = variable->ID;
2133
2.12M
            slot->flag = variable->flag;
2134
2.12M
            slot->kind = variable->kind;
2135
2.12M
      slot->value = variable->value;
2136
#ifdef mxTrace
2137
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2138
#endif
2139
2.12M
      mxBreak;
2140
2.12M
    mxCase(XS_CODE_STORE_ARROW)
2141
      // super
2142
357k
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2143
357k
      slot = mxFunctionInstanceHome((mxStack + 1)->value.reference);
2144
357k
      slot->value.home.object = variable->value.home.object;
2145
      // target
2146
357k
      address = &(mxStack->value.reference->next);
2147
714k
      while ((slot = *address)) {
2148
357k
        address = &slot->next;
2149
357k
      }
2150
357k
      if (mxFrameHasTarget) {
2151
5
        mxSaveState;
2152
5
        *address = slot = fxNewSlot(the);
2153
5
        mxRestoreState;
2154
5
        slot->ID = mxID(_new_target);
2155
5
        variable = mxFrameTarget;
2156
5
        slot->kind = variable->kind;
2157
5
        slot->value = variable->value;
2158
5
        address = &slot->next;
2159
5
      }
2160
      // this
2161
357k
      mxSaveState;
2162
357k
      *address = slot = fxNewSlot(the);
2163
357k
      mxRestoreState;
2164
357k
      variable = mxFrameThis;
2165
357k
      slot->ID = mxID(_this);
2166
357k
      slot->kind = variable->kind;
2167
357k
      slot->value = variable->value;
2168
357k
      mxNextCode(1);
2169
357k
      mxBreak;
2170
      
2171
357k
    mxCase(XS_CODE_USED_2)
2172
0
      index = mxRunU2(1);
2173
0
      mxNextCode(3);
2174
0
      goto XS_CODE_USED;
2175
0
    mxCase(XS_CODE_USED_1)
2176
0
      index = mxRunU1(1);
2177
0
      mxNextCode(2);
2178
0
    XS_CODE_USED:
2179
0
      slot = mxEnvironment - index;
2180
0
      mxSaveState;
2181
0
      fxRunUsed(the, slot);
2182
0
      mxRestoreState;
2183
0
      mxBreak;
2184
0
    mxCase(XS_CODE_USING)
2185
0
      mxNextCode(1);
2186
0
      mxSaveState;
2187
0
      fxRunUsing(the);
2188
0
      mxRestoreState;
2189
0
      mxBreak;
2190
0
    mxCase(XS_CODE_USING_ASYNC)
2191
0
      mxNextCode(1);
2192
0
      mxSaveState;
2193
0
      fxRunUsingAsync(the);
2194
0
      mxRestoreState;
2195
0
      mxBreak;
2196
        
2197
  /* PROPERTIES */  
2198
7.53M
    mxCase(XS_CODE_CHECK_INSTANCE)
2199
7.53M
      if (mxStack->kind != XS_REFERENCE_KIND)
2200
7.53M
        mxRunDebug(XS_TYPE_ERROR, "iterator result: not an object");
2201
7.53M
      mxNextCode(1);
2202
7.53M
      mxBreak;
2203
7.53M
    mxCase(XS_CODE_TO_INSTANCE)
2204
104k
      mxToInstance(mxStack);
2205
104k
      mxNextCode(1);
2206
104k
      mxBreak;
2207
      
2208
104k
    mxCase(XS_CODE_SUPER_AT_2)
2209
0
      slot = mxStack + 2;
2210
0
      goto XS_CODE_SUPER_AT_ALL;
2211
43
    mxCase(XS_CODE_SUPER_AT)
2212
43
      slot = mxStack + 1;
2213
      /* continue */
2214
43
    XS_CODE_SUPER_AT_ALL:
2215
43
      mxToInstance(slot);
2216
43
      slot->value.super.reference = variable;
2217
43
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2218
43
      if (!variable->value.home.object) 
2219
43
        mxRunDebugID(XS_TYPE_ERROR, "super.%s: no home", (txID)offset);
2220
43
      variable = fxGetPrototype(the, variable->value.home.object);
2221
43
      if (!variable)
2222
43
        mxRunDebugID(XS_TYPE_ERROR, "super.%s: no prototype", (txID)offset);
2223
43
      slot->value.super.prototype = variable;
2224
43
      slot--;
2225
43
      goto XS_CODE_AT_ALL;
2226
344k
    mxCase(XS_CODE_AT_2)
2227
344k
      mxToInstance(mxStack + 2);
2228
344k
      slot = mxStack + 1;
2229
344k
      goto XS_CODE_AT_ALL;
2230
15.3M
    mxCase(XS_CODE_AT)
2231
15.3M
      mxToInstance(mxStack + 1);
2232
15.3M
      slot = mxStack;
2233
      /* continue */
2234
15.6M
    XS_CODE_AT_ALL:
2235
15.6M
      if (slot->kind == XS_REFERENCE_KIND) {
2236
2.28k
        mxSaveState;
2237
2.28k
        fxToPrimitive(the, slot, XS_STRING_HINT);
2238
2.28k
        mxRestoreState;
2239
2.28k
      }
2240
15.6M
      if ((slot->kind == XS_INTEGER_KIND) && fxIntegerToIndex(the, slot->value.integer, &(scratch.value.at.index))) {
2241
12.0M
        slot->kind = XS_AT_KIND;
2242
12.0M
        slot->value.at.id = XS_NO_ID;
2243
12.0M
        slot->value.at.index = scratch.value.at.index;
2244
12.0M
      }
2245
3.61M
      else if ((slot->kind == XS_NUMBER_KIND) && fxNumberToIndex(the, slot->value.number, &(scratch.value.at.index))) {
2246
422k
        slot->kind = XS_AT_KIND;
2247
422k
        slot->value.at.id = XS_NO_ID;
2248
422k
        slot->value.at.index = scratch.value.at.index;
2249
422k
      }
2250
3.18M
      else if (slot->kind == XS_SYMBOL_KIND) {
2251
231k
        slot->kind = XS_AT_KIND;
2252
231k
        slot->value.at.id = slot->value.symbol;
2253
231k
        slot->value.at.index = 0;
2254
231k
      }
2255
2.95M
      else {
2256
2.95M
        txFlag flag;
2257
2258
2.95M
        mxToString(slot);
2259
2.95M
        mxSaveState;
2260
2.95M
        flag = fxStringToIndex(the, slot->value.string, &(scratch.value.at.index));
2261
2.95M
        mxRestoreState;
2262
2.95M
        if (flag) {
2263
62.4k
#ifdef mxMetering
2264
62.4k
          the->meterIndex += 2 * XS_CODE_METERING;
2265
62.4k
#endif
2266
62.4k
          slot->kind = XS_AT_KIND;
2267
62.4k
          slot->value.at.id = XS_NO_ID;
2268
62.4k
          slot->value.at.index = scratch.value.at.index;
2269
62.4k
        }
2270
2.89M
        else {
2271
2.89M
          txID id;
2272
2.89M
          mxSaveState;
2273
2.89M
          if (slot->kind == XS_STRING_X_KIND)
2274
0
            id = fxNewNameX(the, slot->value.string);
2275
2.89M
          else
2276
2.89M
            id = fxNewName(the, slot);
2277
2.89M
          mxRestoreState;
2278
2.89M
          slot->kind = XS_AT_KIND;
2279
2.89M
          slot->value.at.id = id;
2280
2.89M
          slot->value.at.index = 0;
2281
2.89M
        }
2282
2.95M
      }
2283
15.6M
      mxNextCode(1);
2284
15.6M
      mxBreak;
2285
2286
15.6M
    mxCase(XS_CODE_DELETE_SUPER_AT)
2287
0
      variable = (mxStack + 1)->value.reference;
2288
0
      offset = XS_NO_ID;
2289
0
      index = 0;
2290
0
      mxStack++;
2291
0
      mxNextCode(1);
2292
0
      goto XS_CODE_DELETE_SUPER_ALL;
2293
0
    mxCase(XS_CODE_DELETE_SUPER)
2294
0
      mxToInstance(mxStack);
2295
0
      offset = mxRunID(1);
2296
0
      index = 0;
2297
0
      mxNextCode(1 + sizeof(txID));
2298
      /* continue */
2299
0
    XS_CODE_DELETE_SUPER_ALL: 
2300
0
      mxRunDebugID(XS_REFERENCE_ERROR, "delete super.%s", (txID)offset);
2301
0
      mxBreak;
2302
2303
135k
    mxCase(XS_CODE_DELETE_PROPERTY_AT)
2304
135k
      variable = (mxStack + 1)->value.reference;
2305
135k
      offset = mxStack->value.at.id;
2306
135k
      index = mxStack->value.at.index;
2307
135k
      the->stack = mxStack;
2308
135k
      mxStack++;
2309
135k
      mxNextCode(1);
2310
135k
      goto XS_CODE_DELETE_PROPERTY_ALL;
2311
572k
    mxCase(XS_CODE_DELETE_PROPERTY)
2312
572k
      mxToInstance(mxStack);
2313
572k
      offset = mxRunID(1);
2314
572k
      index = 0;
2315
572k
      the->stack = mxStack;
2316
572k
      mxNextCode(1 + sizeof(txID));
2317
      /* continue */
2318
708k
    XS_CODE_DELETE_PROPERTY_ALL:  
2319
#ifdef mxTrace
2320
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2321
#endif
2322
708k
      mxSaveStateKeepStack;
2323
708k
      index = (txU4)fxRunDelete(the, variable, (txID)offset, index);
2324
708k
      mxRestoreStateKeepStack;
2325
708k
      if (!index && (mxFrame->flag & XS_STRICT_FLAG))
2326
708k
        mxRunDebugID(XS_TYPE_ERROR, "delete %s: no permission (strict mode)", (txID)offset);
2327
708k
      mxStack->kind = XS_BOOLEAN_KIND;
2328
708k
      mxStack->value.boolean = index;
2329
708k
      mxBreak;
2330
      
2331
88.4M
    mxCase(XS_CODE_GET_THIS_VARIABLE)
2332
121M
    mxCase(XS_CODE_GET_VARIABLE)
2333
121M
      mxToInstance(mxStack);
2334
121M
      offset = mxRunID(1);
2335
121M
      index = 0;
2336
121M
      mxNextCode(1 + sizeof(txID));
2337
121M
    #ifdef mxWithHasGetSequence
2338
121M
      if (variable->next && ((variable->next->ID == XS_ENVIRONMENT_BEHAVIOR) || (variable->next->ID == XS_GLOBAL_BEHAVIOR))) {
2339
121M
      }
2340
438
      else {
2341
438
              mxSaveState;
2342
438
              index = fxRunHas(the, variable, (txID)offset, index);
2343
438
              mxRestoreState;
2344
438
        if (index == 0) {
2345
0
          if (the->frame->flag & XS_STRICT_FLAG)
2346
0
            mxRunDebugID(XS_REFERENCE_ERROR, "get %s: undefined property", (txID)offset);
2347
0
          mxStack->kind = XS_UNDEFINED_KIND;
2348
0
          mxBreak;
2349
0
        }
2350
438
        else 
2351
438
          index = 0;
2352
438
      }
2353
121M
    #endif
2354
121M
      slot = mxBehaviorGetProperty(the, variable, (txID)offset, index, XS_ANY);
2355
121M
      if (slot) {
2356
120M
        if (slot->kind < 0)
2357
120M
          mxRunDebugID(XS_REFERENCE_ERROR, "get %s: not initialized yet", (txID)offset);
2358
120M
      }
2359
1.15M
      else {
2360
1.15M
        if (byte != XS_CODE_TYPEOF)
2361
787k
          mxRunDebugID(XS_REFERENCE_ERROR, "get %s: undefined variable", (txID)offset);
2362
370k
      }
2363
120M
      goto XS_CODE_GET_ALL;
2364
120M
    mxCase(XS_CODE_GET_SUPER_AT)
2365
43
      variable = (mxStack + 1)->value.super.reference;
2366
43
      slot = (mxStack + 1)->value.super.prototype;
2367
43
      offset = mxStack->value.at.id;
2368
43
      index = mxStack->value.at.index;
2369
43
      mxStack++;
2370
43
      mxNextCode(1);
2371
43
      goto XS_CODE_GET_SUPER_ALL;
2372
0
    mxCase(XS_CODE_GET_SUPER)
2373
0
      mxToInstance(mxStack);
2374
0
      offset = mxRunID(1);
2375
0
      index = 0;
2376
0
      mxNextCode(1 + sizeof(txID));
2377
0
      slot = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2378
0
      if (!slot->value.home.object)
2379
0
        mxRunDebugID(XS_TYPE_ERROR, "get super.%s: no home", (txID)offset);
2380
0
      slot = fxGetPrototype(the, slot->value.home.object);
2381
0
      if (!slot)
2382
0
        mxRunDebugID(XS_TYPE_ERROR, "get super.%s: no prototype", (txID)offset);
2383
      /* continue */
2384
43
    XS_CODE_GET_SUPER_ALL:  
2385
43
      slot = mxBehaviorGetProperty(the, slot, (txID)offset, index, XS_ANY);
2386
43
      goto XS_CODE_GET_ALL;
2387
0
    mxCase(XS_CODE_GET_PRIVATE_2)
2388
0
      index = mxRunU2(1);
2389
0
      mxNextCode(3);
2390
0
      goto XS_CODE_GET_PRIVATE;
2391
9.04k
    mxCase(XS_CODE_GET_PRIVATE_1)
2392
9.04k
      index = mxRunU1(1);
2393
9.04k
      mxNextCode(2);
2394
9.04k
    XS_CODE_GET_PRIVATE:
2395
#ifdef mxTrace
2396
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2397
#endif
2398
9.04k
      slot = (mxEnvironment - index);
2399
9.04k
      mxToInstance(mxStack);
2400
9.04k
      offset = slot->ID;
2401
9.04k
      index = 0;
2402
9.04k
      if (slot->value.closure->kind < 0)
2403
9.04k
        mxRunDebugID(XS_TYPE_ERROR, "get %s: undefined private property", (txID)offset);
2404
9.04k
      slot = gxDefaults.getPrivateProperty(the, variable, slot->value.closure->value.reference, (txID)offset);
2405
9.04k
      if (!slot)
2406
9.03k
        mxRunDebugID(XS_TYPE_ERROR, "get %s: undefined private property", (txID)offset);
2407
9.03k
      goto XS_CODE_GET_ALL;
2408
6.41M
    mxCase(XS_CODE_GET_PROPERTY_AT)
2409
6.41M
      variable = (mxStack + 1)->value.reference;
2410
6.41M
      offset = mxStack->value.at.id;
2411
6.41M
      index = mxStack->value.at.index;
2412
6.41M
      mxStack++;
2413
6.41M
      mxNextCode(1);
2414
6.41M
      goto XS_CODE_GET_PROPERTY_ALL;
2415
61.6M
    mxCase(XS_CODE_GET_PROPERTY)
2416
61.6M
      mxToInstance(mxStack);
2417
61.6M
      offset = mxRunID(1);
2418
61.6M
      index = 0;
2419
61.6M
      mxNextCode(1 + sizeof(txID));
2420
      /* continue */
2421
68.0M
    XS_CODE_GET_PROPERTY_ALL: 
2422
68.0M
      slot = mxBehaviorGetProperty(the, variable, (txID)offset, index, XS_ANY);
2423
188M
    XS_CODE_GET_ALL:  
2424
#ifdef mxTrace
2425
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2426
#endif
2427
188M
      if (!slot) {
2428
15.3M
        mxStack->kind = XS_UNDEFINED_KIND;
2429
15.3M
        mxBreak;
2430
15.3M
      }
2431
188M
      if (slot->kind == XS_ACCESSOR_KIND) {
2432
2.21M
        variable = slot->value.accessor.getter;
2433
2.21M
        if (!mxIsFunction(variable)) {
2434
3
          mxStack->kind = XS_UNDEFINED_KIND;
2435
3
          mxBreak;
2436
3
        }
2437
2.21M
        mxAllocStack(3);
2438
2.21M
        slot = mxStack;
2439
2.21M
        mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2440
2.21M
        mxInitSlotKind(slot++, XS_UNDEFINED_KIND);
2441
2.21M
        slot->value.reference = variable;
2442
2.21M
        mxInitSlotKind(slot++, XS_REFERENCE_KIND);
2443
2.21M
        if (primitive) {
2444
1.07M
          variable = slot->value.reference->next;
2445
1.07M
          slot->value = variable->value;
2446
1.07M
          mxInitSlotKind(slot, variable->kind);
2447
1.07M
        }
2448
2.21M
        offset = 0;
2449
2.21M
        goto XS_CODE_RUN_ALL;
2450
2.21M
      }
2451
186M
      mxStack->kind = slot->kind;
2452
186M
      mxStack->value = slot->value;
2453
186M
      mxBreak;
2454
      
2455
186M
    mxCase(XS_CODE_NEW_PRIVATE_2)
2456
0
      index = mxRunU2(1);
2457
0
      mxNextCode(3);
2458
0
      goto XS_CODE_NEW_PRIVATE;
2459
21.8k
    mxCase(XS_CODE_NEW_PRIVATE_1)
2460
21.8k
      index = mxRunU1(1);
2461
21.8k
      mxNextCode(2);
2462
21.8k
    XS_CODE_NEW_PRIVATE:
2463
#ifdef mxTrace
2464
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2465
#endif
2466
21.8k
      slot = (mxEnvironment - index);
2467
21.8k
      mxToInstance(mxStack + 1);
2468
21.8k
      offset = slot->ID;
2469
21.8k
      index = 0;
2470
21.8k
      slot = slot->value.closure->value.reference;
2471
21.8k
      the->stack = mxStack;
2472
21.8k
      goto XS_CODE_NEW_PROPERTY_ALL;
2473
8.74M
    mxCase(XS_CODE_NEW_PROPERTY_AT)
2474
8.74M
      mxToInstance(mxStack + 2);
2475
8.74M
      offset = (mxStack + 1)->value.at.id;
2476
8.74M
      index = (mxStack + 1)->value.at.index;
2477
8.74M
      slot = C_NULL;
2478
8.74M
      the->stack = mxStack;
2479
8.74M
      mxStack++;
2480
8.74M
      scratch = *(the->stack);
2481
8.74M
      *(the->stack) = *mxStack;
2482
8.74M
      *mxStack = scratch;
2483
8.74M
      mxNextCode(1);
2484
8.74M
      goto XS_CODE_NEW_PROPERTY_ALL;
2485
8.52M
    mxCase(XS_CODE_NEW_PROPERTY)
2486
8.52M
      mxToInstance(mxStack + 1);
2487
8.52M
      offset = mxRunID(1);
2488
8.52M
      index = 0;
2489
8.52M
      slot = C_NULL;
2490
8.52M
      the->stack = mxStack;
2491
8.52M
      mxNextCode(1 + sizeof(txID));
2492
17.2M
    XS_CODE_NEW_PROPERTY_ALL:
2493
17.2M
      byte = mxRunU1(1);
2494
17.2M
      mxSaveStateKeepStack;
2495
17.2M
      if (byte & XS_GETTER_FLAG) {
2496
352k
        mxStack->value.accessor.getter = fxToInstance(the, mxStack);
2497
352k
        mxStack->value.accessor.setter = C_NULL;
2498
352k
        mxStack->kind = XS_ACCESSOR_KIND;
2499
352k
      }
2500
16.9M
      else if (byte & XS_SETTER_FLAG) {
2501
4.63k
        mxStack->value.accessor.setter = fxToInstance(the, mxStack);
2502
4.63k
        mxStack->value.accessor.getter = C_NULL;
2503
4.63k
        mxStack->kind = XS_ACCESSOR_KIND;
2504
4.63k
      }
2505
17.2M
      mxStack->flag = byte & XS_GET_ONLY;
2506
17.2M
      index = fxRunDefine(the, variable, slot, (txID)offset, index, mxStack, byte | XS_GET_ONLY);
2507
17.2M
      mxRestoreStateKeepStack;
2508
17.2M
      mxStack += 2;
2509
17.2M
      if (!index)
2510
17.2M
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", (txID)offset);
2511
17.2M
      mxNextCode(2);
2512
17.2M
      mxBreak;
2513
      
2514
46.8M
    mxCase(XS_CODE_SET_VARIABLE)
2515
46.8M
      mxToInstance(mxStack + 1);
2516
46.8M
      offset = mxRunID(1);
2517
46.8M
      index = 0;
2518
46.8M
      mxNextCode(1 + sizeof(txID));
2519
46.8M
      if (variable->next && (variable->next->ID == XS_ENVIRONMENT_BEHAVIOR)) {
2520
        // nop
2521
6.50k
      }
2522
46.8M
      else {
2523
46.8M
              mxSaveState;
2524
46.8M
              index = fxRunHas(the, variable, (txID)offset, index);
2525
46.8M
              mxRestoreState;
2526
46.8M
        if (index == 0) {
2527
4.34k
          if (the->frame->flag & XS_STRICT_FLAG)
2528
4.07k
            mxRunDebugID(XS_REFERENCE_ERROR, "set %s: undefined property", (txID)offset);
2529
4.07k
        }
2530
46.8M
        else 
2531
46.8M
          index = 0;
2532
46.8M
      }
2533
46.8M
            mxSaveState;
2534
46.8M
      slot = mxBehaviorSetProperty(the, variable, (txID)offset, index, XS_ANY);
2535
46.8M
      mxRestoreState;
2536
46.8M
      if (slot && (slot->kind < 0))
2537
46.8M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", (txID)offset);
2538
46.8M
      goto XS_CODE_SET_ALL;
2539
0
    mxCase(XS_CODE_SET_SUPER_AT)
2540
0
      variable = (mxStack + 2)->value.super.reference;
2541
0
      slot = (mxStack + 2)->value.super.prototype;
2542
0
      offset = (mxStack + 1)->value.at.id;
2543
0
      index = (mxStack + 1)->value.at.index;
2544
0
      the->stack = mxStack;
2545
0
      mxStack++;
2546
0
      scratch = *(the->stack);
2547
0
      *(the->stack) = *mxStack;
2548
0
      *mxStack = scratch;
2549
0
      mxNextCode(1);
2550
0
      goto XS_CODE_SET_SUPER_ALL;
2551
0
    mxCase(XS_CODE_SET_SUPER)
2552
0
      mxToInstance(mxStack + 1);
2553
0
      offset = mxRunID(1);
2554
0
      index = 0;
2555
0
      the->stack = mxStack;
2556
0
      mxNextCode(1 + sizeof(txID));
2557
0
      slot = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2558
0
      if (!slot->value.home.object)
2559
0
        mxRunDebugID(XS_TYPE_ERROR, "set super.%s: no home", (txID)offset);
2560
0
      slot = fxGetPrototype(the, slot->value.home.object);
2561
0
      if (!slot)
2562
0
        mxRunDebugID(XS_TYPE_ERROR, "set super.%s: no prototype", (txID)offset);
2563
      /* continue */
2564
0
    XS_CODE_SET_SUPER_ALL:
2565
0
      slot = mxBehaviorGetProperty(the, slot, (txID)offset, index, XS_ANY);
2566
0
      if (!slot || (slot->kind != XS_ACCESSOR_KIND)) {
2567
0
        mxSaveStateKeepStack;
2568
0
        slot = mxBehaviorSetProperty(the, variable, (txID)offset, index, XS_OWN);
2569
0
        mxRestoreStateKeepStack;
2570
0
      }
2571
0
      goto XS_CODE_SET_ALL;
2572
0
    mxCase(XS_CODE_SET_PRIVATE_2)
2573
0
      index = mxRunU2(1);
2574
0
      mxNextCode(3);
2575
0
      goto XS_CODE_SET_PRIVATE;
2576
11
    mxCase(XS_CODE_SET_PRIVATE_1)
2577
11
      index = mxRunU1(1);
2578
11
      mxNextCode(2);
2579
11
    XS_CODE_SET_PRIVATE:
2580
#ifdef mxTrace
2581
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2582
#endif
2583
11
      slot = (mxEnvironment - index);
2584
11
      mxToInstance(mxStack + 1);
2585
11
      offset = slot->ID;
2586
11
      index = 0;
2587
11
      if (slot->value.closure->kind < 0)
2588
11
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: undefined private property", (txID)offset);
2589
11
      slot = gxDefaults.setPrivateProperty(the, variable, slot->value.closure->value.reference, (txID)offset);
2590
11
      if (!slot)
2591
9
        mxRunDebugID(XS_TYPE_ERROR, "set %s: undefined private property", (txID)offset);
2592
9
      goto XS_CODE_SET_ALL;
2593
1.96M
    mxCase(XS_CODE_SET_PROPERTY_AT)
2594
1.96M
      variable = (mxStack + 2)->value.reference;
2595
1.96M
      offset = (mxStack + 1)->value.at.id;
2596
1.96M
      index = (mxStack + 1)->value.at.index;
2597
1.96M
      the->stack = mxStack;
2598
1.96M
      mxStack++;
2599
1.96M
      scratch = *(the->stack);
2600
1.96M
      *(the->stack) = *mxStack;
2601
1.96M
      *mxStack = scratch;
2602
1.96M
      mxNextCode(1);
2603
1.96M
      goto XS_CODE_SET_PROPERTY_ALL;
2604
10.0M
    mxCase(XS_CODE_SET_PROPERTY)
2605
10.0M
      mxToInstance(mxStack + 1);
2606
10.0M
      offset = mxRunID(1);
2607
10.0M
      index = 0;
2608
10.0M
      the->stack = mxStack;
2609
10.0M
      mxNextCode(1 + sizeof(txID));
2610
      /* continue */
2611
12.0M
    XS_CODE_SET_PROPERTY_ALL: 
2612
12.0M
      mxSaveStateKeepStack;
2613
12.0M
      slot = mxBehaviorSetProperty(the, variable, (txID)offset, index, XS_ANY);
2614
12.0M
      mxRestoreStateKeepStack;
2615
58.8M
    XS_CODE_SET_ALL:  
2616
#ifdef mxTrace
2617
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2618
#endif
2619
58.8M
      if (!slot) {
2620
45.6k
        if (mxFrame->flag & XS_STRICT_FLAG) {
2621
7
          mxRunDebugID(XS_TYPE_ERROR, "set %s: not extensible", (txID)offset);
2622
0
        }
2623
45.6k
        goto XS_CODE_SET_SKIP;
2624
45.6k
      }
2625
58.8M
      if (slot->kind == XS_ACCESSOR_KIND) {
2626
6.39M
        variable = slot->value.accessor.setter;
2627
6.39M
        if (!mxIsFunction(variable)) {
2628
10
          if (mxFrame->flag & XS_STRICT_FLAG) {
2629
1
            mxRunDebugID(XS_TYPE_ERROR, "set %s: no setter", (txID)offset);
2630
0
          }
2631
9
          goto XS_CODE_SET_SKIP;
2632
10
        }
2633
6.39M
        slot = mxStack;
2634
6.39M
        mxAllocStack(3);
2635
6.39M
        mxStack->value = slot->value;
2636
6.39M
        mxInitSlotKind(mxStack, slot->kind);
2637
6.39M
        slot = mxStack + 1;
2638
6.39M
        mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2639
6.39M
        slot->value = mxStack->value;
2640
6.39M
        mxInitSlotKind(slot++, mxStack->kind);
2641
6.39M
        slot->value.reference = variable;
2642
6.39M
        mxInitSlotKind(slot++, XS_REFERENCE_KIND);
2643
6.39M
        offset = 1;
2644
6.39M
        goto XS_CODE_RUN_ALL;
2645
6.39M
      }
2646
52.4M
      if (slot->flag & (XS_DONT_SET_FLAG | XS_MARK_FLAG)) {
2647
2.91k
        if (mxFrame->flag & XS_STRICT_FLAG) {
2648
5
          mxRunDebugID(XS_TYPE_ERROR, "set %s: not writable", (txID)offset);
2649
0
        }
2650
2.91k
        goto XS_CODE_SET_SKIP;
2651
2.91k
      }
2652
52.4M
      slot->kind = mxStack->kind;
2653
52.4M
      slot->value = mxStack->value;
2654
52.4M
    XS_CODE_SET_SKIP:
2655
52.4M
      *(mxStack + 1) = *mxStack;
2656
52.4M
      mxStack++;
2657
52.4M
      mxBreak;
2658
      
2659
52.4M
    mxCase(XS_CODE_HAS_PRIVATE_2)
2660
0
      index = mxRunU2(1);
2661
0
      mxNextCode(3);
2662
0
      goto XS_CODE_HAS_PRIVATE;
2663
0
    mxCase(XS_CODE_HAS_PRIVATE_1)
2664
0
      index = mxRunU1(1);
2665
0
      mxNextCode(2);
2666
0
    XS_CODE_HAS_PRIVATE:
2667
#ifdef mxTrace
2668
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2669
#endif
2670
0
      slot = (mxEnvironment - index);
2671
0
      if (mxStack->kind == XS_REFERENCE_KIND)
2672
0
        variable = mxStack->value.reference; 
2673
0
      else
2674
0
        mxRunDebug(XS_TYPE_ERROR, "in: not an object");
2675
0
      offset = slot->ID;
2676
0
      index = 0;
2677
0
      if (slot->value.closure->kind < 0)
2678
0
        mxRunDebugID(XS_TYPE_ERROR, "get %s: undefined private property", (txID)offset);
2679
0
      slot = gxDefaults.getPrivateProperty(the, variable, slot->value.closure->value.reference, (txID)offset);
2680
0
      mxStack->kind = XS_BOOLEAN_KIND;
2681
0
      mxStack->value.boolean = (slot) ? 1 : 0;
2682
0
      mxBreak;
2683
            
2684
  /* INSTANCES */  
2685
5.45M
    mxCase(XS_CODE_ARRAY)
2686
//      mxAllocStack(1);
2687
5.45M
      mxSaveState;
2688
5.45M
      fxNewArray(the, 0);
2689
5.45M
      mxRestoreState;
2690
5.45M
      mxNextCode(1);
2691
5.45M
      mxBreak;
2692
5.45M
    mxCase(XS_CODE_CLASS)
2693
65.7k
      variable = fxToInstance(the, mxStack);
2694
65.7k
      slot = mxStack + 2;
2695
65.7k
      variable->flag |= XS_CAN_CONSTRUCT_FLAG;
2696
65.7k
      if (slot->kind == XS_NULL_KIND)
2697
8.51k
        variable->next->flag |= XS_BASE_FLAG;
2698
57.2k
      else {
2699
57.2k
        variable->next->flag |= XS_DERIVED_FLAG;
2700
57.2k
        variable->value.instance.prototype = slot->value.reference;
2701
57.2k
      }
2702
65.7k
      slot = mxStack + 1;
2703
65.7k
      mxFunctionInstanceHome(variable)->value.home.object = slot->value.reference;
2704
65.7k
      mxSaveState;
2705
65.7k
      slot->flag = XS_GET_ONLY;
2706
65.7k
      fxRunDefine(the, variable, C_NULL, mxID(_prototype), 0, slot, XS_GET_ONLY);
2707
65.7k
      slot = mxBehaviorSetProperty(the, slot->value.reference, mxID(_constructor), 0, XS_OWN);
2708
65.7k
      mxRestoreState;
2709
65.7k
      slot->flag |= XS_DONT_ENUM_FLAG;
2710
65.7k
      slot->kind = mxStack->kind;
2711
65.7k
      slot->value = mxStack->value;
2712
65.7k
      mxStack += 3;
2713
65.7k
            mxNextCode(1);
2714
65.7k
      mxBreak;
2715
65.7k
    mxCase(XS_CODE_COPY_OBJECT)
2716
9.29k
      mxNextCode(1);
2717
9.29k
      mxAllocStack(1);
2718
9.29k
      *mxStack = mxCopyObjectFunction;
2719
9.29k
      mxBreak;
2720
57.2k
    mxCase(XS_CODE_EXTEND)
2721
57.2k
      if (mxStack->kind == XS_NULL_KIND) {
2722
0
        mxSaveState;
2723
0
        fxNewInstance(the);
2724
0
        mxRestoreState;
2725
0
      }
2726
57.2k
      else {
2727
57.2k
        mxSaveState;
2728
57.2k
        fxRunExtends(the);
2729
57.2k
        mxRestoreState;
2730
57.2k
      }
2731
57.2k
            mxNextCode(1);
2732
57.2k
      mxBreak;
2733
397k
    mxCase(XS_CODE_GLOBAL)
2734
397k
      mxPushKind(XS_REFERENCE_KIND);
2735
397k
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
2736
397k
      variable = mxModuleInstanceInternal(variable)->value.module.realm;
2737
397k
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
2738
397k
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
2739
397k
      mxNextCode(1);
2740
397k
      mxBreak;
2741
397k
    mxCase(XS_CODE_HOST)
2742
0
      index = mxRunU2(1);
2743
#ifdef mxTrace
2744
      if (gxDoTrace) fxTraceIndex(the, index);
2745
#endif
2746
0
      mxAllocStack(1);
2747
0
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
2748
0
      variable = mxModuleInstanceHosts(variable);
2749
0
      *mxStack = *variable;
2750
0
      slot = mxBehaviorGetProperty(the, mxStack->value.reference, 0, index, XS_OWN);
2751
0
      mxStack->kind = slot->kind;
2752
0
      mxStack->value = slot->value;
2753
0
      mxNextCode(3);
2754
0
      mxBreak;
2755
125
    mxCase(XS_CODE_INSTANTIATE)
2756
125
      mxSaveState;
2757
125
      fxRunInstantiate(the);
2758
125
      mxRestoreState;
2759
125
      mxNextCode(1);
2760
125
      mxBreak;
2761
40.0M
    mxCase(XS_CODE_CALL)
2762
40.0M
      mxNextCode(1);
2763
40.0M
      mxAllocStack(2);
2764
40.0M
      slot = mxStack;
2765
40.0M
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2766
40.0M
      mxInitSlotKind(slot, XS_UNDEFINED_KIND);
2767
40.0M
      mxBreak;
2768
40.0M
    mxCase(XS_CODE_NEW)
2769
4.47M
      mxNextCode(1);
2770
4.47M
      variable = mxStack;
2771
4.47M
      mxAllocStack(4);
2772
4.47M
      slot = mxStack;
2773
4.47M
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2774
4.47M
      mxInitSlotKind(slot++, XS_UNDEFINED_KIND);
2775
4.47M
      slot->value = variable->value;
2776
4.47M
      mxInitSlotKind(slot++, variable->kind);
2777
4.47M
      mxInitSlotKind(slot, XS_UNINITIALIZED_KIND);
2778
4.47M
      mxBreak;
2779
4.47M
    mxCase(XS_CODE_OBJECT)
2780
//      mxAllocStack(1);
2781
3.98M
      mxSaveState;
2782
3.98M
      fxNewObject(the);
2783
3.98M
      mxRestoreState;
2784
3.98M
      mxNextCode(1);
2785
3.98M
      mxBreak;
2786
3.98M
    mxCase(XS_CODE_REGEXP)
2787
483k
      mxNextCode(1);
2788
483k
      mxAllocStack(1);
2789
483k
      *mxStack = mxRegExpConstructor;
2790
483k
      mxBreak;
2791
483k
    mxCase(XS_CODE_SUPER)
2792
203
      mxNextCode(1);
2793
203
      variable = mxFrameFunction->value.reference;
2794
203
            if (mxIsConstructor(variable))
2795
203
        variable = fxGetPrototype(the, variable);
2796
0
      else {
2797
0
        variable = mxFunctionInstanceHome(variable);
2798
0
        variable = mxBehaviorGetProperty(the, variable->value.home.object, mxID(_constructor), 0, XS_ANY);
2799
0
        variable = fxGetPrototype(the, variable->value.reference);
2800
0
      }
2801
203
            if (!mxIsConstructor(variable))
2802
203
        mxRunDebug(XS_TYPE_ERROR, "super: not a constructor");
2803
203
      mxAllocStack(5);
2804
203
      slot = mxStack;
2805
203
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2806
203
      mxInitSlotKind(slot++, XS_UNDEFINED_KIND);
2807
203
      slot->value.reference = variable;
2808
203
      mxInitSlotKind(slot++, XS_REFERENCE_KIND);
2809
203
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2810
203
      if (mxFrameHasTarget) {
2811
203
        slot->value = mxFrameTarget->value;
2812
203
        mxInitSlotKind(slot, mxFrameTarget->kind);
2813
203
      }
2814
0
      else
2815
0
        mxInitSlotKind(slot, XS_UNDEFINED_KIND);
2816
203
      mxBreak;
2817
3.85k
    mxCase(XS_CODE_TEMPLATE)
2818
3.85k
      mxNextCode(1);
2819
3.85k
      variable = mxStack->value.reference;
2820
3.85k
      slot = mxBehaviorGetProperty(the, variable, mxID(_raw), 0, XS_OWN);
2821
3.85k
            if (!slot)
2822
3.85k
        mxRunDebug(XS_TYPE_ERROR, "template: no raw");
2823
3.85k
      variable->flag |= XS_DONT_PATCH_FLAG;
2824
3.85k
      variable->next->flag |= XS_DONT_SET_FLAG;
2825
3.85k
      slot->flag |= XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG;
2826
3.85k
      variable = slot->value.reference;
2827
3.85k
      variable->flag |= XS_DONT_PATCH_FLAG;
2828
3.85k
      variable->next->flag |= XS_DONT_SET_FLAG;
2829
3.85k
      mxBreak;
2830
4.00M
    mxCase(XS_CODE_TEMPLATE_CACHE)
2831
4.00M
      mxNextCode(1);
2832
4.00M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
2833
4.00M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
2834
4.00M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
2835
4.00M
            slot = mxRealmTemplateCache(variable);
2836
4.00M
      mxPushKind(XS_REFERENCE_KIND);
2837
4.00M
      mxStack->value.reference = slot->value.reference;
2838
4.00M
      mxBreak;
2839
      
2840
  /* FUNCTIONS */    
2841
4.00M
    mxCase(XS_CODE_ASYNC_FUNCTION)
2842
691k
      offset = mxRunID(1);
2843
#ifdef mxTrace
2844
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2845
#endif
2846
691k
      mxAllocStack(1);
2847
691k
      *mxStack = mxAsyncFunctionPrototype;
2848
691k
      mxSaveState;
2849
691k
      fxNewFunctionInstance(the, (txID)offset);
2850
691k
      mxRestoreState;
2851
691k
      mxNextCode(1 + sizeof(txID));
2852
691k
      mxBreak;
2853
691k
    mxCase(XS_CODE_ASYNC_GENERATOR_FUNCTION)
2854
2.21k
      offset = mxRunID(1);
2855
#ifdef mxTrace
2856
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2857
#endif
2858
2.21k
      mxAllocStack(1);
2859
2.21k
      *mxStack = mxAsyncGeneratorFunctionPrototype;
2860
2.21k
      mxSaveState;
2861
2.21k
      gxDefaults.newAsyncGeneratorFunctionInstance(the,(txID) offset);
2862
2.21k
      mxRestoreState;
2863
2.21k
      mxNextCode(1 + sizeof(txID));
2864
2.21k
      mxBreak;
2865
2.19M
    mxCase(XS_CODE_CONSTRUCTOR_FUNCTION)
2866
2.19M
      offset = mxRunID(1);
2867
#ifdef mxTrace
2868
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2869
#endif
2870
2.19M
      mxAllocStack(1);
2871
2.19M
      *mxStack = mxFunctionPrototype;
2872
2.19M
      mxSaveState;
2873
2.19M
      fxNewFunctionInstance(the, (txID)offset);
2874
2.19M
      fxDefaultFunctionPrototype(the);
2875
2.19M
      mxRestoreState;
2876
2.19M
      mxNextCode(1 + sizeof(txID));
2877
2.19M
      mxBreak;
2878
2.19M
    mxCase(XS_CODE_FUNCTION)
2879
1.78M
      offset = mxRunID(1);
2880
#ifdef mxTrace
2881
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2882
#endif
2883
1.78M
      mxAllocStack(1);
2884
1.78M
      *mxStack = mxFunctionPrototype;
2885
1.78M
      mxSaveState;
2886
1.78M
      fxNewFunctionInstance(the, (txID)offset);
2887
1.78M
      mxRestoreState;
2888
1.78M
      mxNextCode(1 + sizeof(txID));
2889
1.78M
      mxBreak;
2890
1.78M
    mxCase(XS_CODE_GENERATOR_FUNCTION)
2891
25.5k
      offset = mxRunID(1);
2892
#ifdef mxTrace
2893
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2894
#endif
2895
25.5k
      mxAllocStack(1);
2896
25.5k
      *mxStack = mxGeneratorFunctionPrototype;
2897
25.5k
      mxSaveState;
2898
25.5k
      gxDefaults.newGeneratorFunctionInstance(the,(txID) offset);
2899
25.5k
      mxRestoreState;
2900
25.5k
      mxNextCode(1 + sizeof(txID));
2901
25.5k
      mxBreak;
2902
4.69M
    mxCase(XS_CODE_PROFILE)
2903
4.69M
      offset = mxRunID(1);
2904
4.69M
      variable = mxFunctionInstanceHome(mxStack->value.reference);
2905
4.69M
      variable->ID = offset;
2906
4.69M
      mxNextCode(1 + sizeof(txID));
2907
4.69M
      mxBreak;
2908
4.69M
    mxCase(XS_CODE_NAME)
2909
63.9k
      offset = mxRunID(1);
2910
#ifdef mxTrace
2911
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2912
#endif
2913
63.9k
      mxSaveState;
2914
63.9k
      fxRenameFunction(the, mxStack->value.reference, (txID)offset, 0, XS_NO_ID, C_NULL);
2915
63.9k
      mxRestoreState;
2916
63.9k
      mxNextCode(1 + sizeof(txID));
2917
63.9k
      mxBreak;
2918
63.9k
    mxCase(XS_CODE_SET_HOME)
2919
4.00k
      slot = mxFunctionInstanceHome((mxStack + 1)->value.reference);
2920
4.00k
      slot->value.home.object = mxStack->value.reference;
2921
4.00k
      mxStack++;
2922
4.00k
      mxNextCode(1);
2923
4.00k
      mxBreak;
2924
5.75k
    mxCase(XS_CODE_CODE_4)
2925
5.75k
      offset = mxRunS4(1);
2926
5.75k
      mxSkipCode(5);
2927
5.75k
      goto XS_CODE_CODE;
2928
671k
    mxCase(XS_CODE_CODE_2)
2929
671k
      offset = mxRunS2(1);
2930
671k
      mxSkipCode(3);
2931
671k
      goto XS_CODE_CODE;
2932
4.01M
    mxCase(XS_CODE_CODE_1)
2933
4.01M
      offset = mxRunS1(1);
2934
4.01M
      mxSkipCode(2);
2935
4.69M
    XS_CODE_CODE:
2936
4.69M
      mxSaveState;
2937
4.69M
      scratch.value.code.address = (txByte*)fxNewChunk(the, (txSize)offset);
2938
4.69M
      mxRestoreState;
2939
4.69M
      c_memcpy(scratch.value.code.address, mxCode, offset);
2940
4.69M
      variable = mxStack->value.reference;
2941
4.69M
      slot = mxFunctionInstanceCode(variable);
2942
4.69M
      slot->kind = XS_CODE_KIND;
2943
4.69M
      slot->value.code.address = scratch.value.code.address;
2944
4.69M
      if (gxDefaults.newFunctionLength) {
2945
4.69M
        gxDefaults.newFunctionLength(the, variable, *(((txU1*)scratch.value.code.address + 1)));
2946
4.69M
      }
2947
4.69M
      mxNextCode(offset);
2948
4.69M
      mxBreak;
2949
4.69M
    mxCase(XS_CODE_CODE_ARCHIVE_4)
2950
0
      offset = mxRunS4(1);
2951
0
      mxSkipCode(5);
2952
0
      goto XS_CODE_CODE_ARCHIVE;
2953
0
    mxCase(XS_CODE_CODE_ARCHIVE_2)
2954
0
      offset = mxRunS2(1);
2955
0
      mxSkipCode(3);
2956
0
      goto XS_CODE_CODE_ARCHIVE;
2957
0
    mxCase(XS_CODE_CODE_ARCHIVE_1)
2958
0
      offset = mxRunS1(1);
2959
0
      mxSkipCode(2);
2960
0
    XS_CODE_CODE_ARCHIVE:
2961
0
      variable = mxStack->value.reference;
2962
0
      slot = mxFunctionInstanceCode(variable);
2963
0
      slot->kind = XS_CODE_X_KIND;
2964
0
      slot->value.code.address = mxCode;
2965
0
      if (gxDefaults.newFunctionLength) {
2966
0
        gxDefaults.newFunctionLength(the, variable, mxRunU1(1));
2967
0
      }
2968
0
      mxNextCode(offset);
2969
0
      mxBreak;
2970
2971
  /* VALUES */    
2972
24.5M
    mxCase(XS_CODE_UNDEFINED)
2973
24.5M
      mxPushKind(XS_UNDEFINED_KIND);
2974
24.5M
      mxNextCode(1);
2975
24.5M
      mxBreak; 
2976
24.5M
    mxCase(XS_CODE_NULL)
2977
2.55M
      mxPushKind(XS_NULL_KIND);
2978
2.55M
      mxNextCode(1);
2979
2.55M
      mxBreak; 
2980
7.76M
    mxCase(XS_CODE_FALSE)
2981
7.76M
      mxPushKind(XS_BOOLEAN_KIND);
2982
7.76M
      mxStack->value.boolean = 0;
2983
7.76M
      mxNextCode(1);
2984
7.76M
      mxBreak;
2985
15.5M
    mxCase(XS_CODE_TRUE)
2986
15.5M
      mxPushKind(XS_BOOLEAN_KIND);
2987
15.5M
      mxStack->value.boolean = 1;
2988
15.5M
      mxNextCode(1);
2989
15.5M
      mxBreak;
2990
109M
    mxCase(XS_CODE_INTEGER_1)
2991
109M
      mxPushKind(XS_INTEGER_KIND);
2992
109M
      mxStack->value.integer = mxRunS1(1);
2993
109M
      mxNextCode(2);
2994
#ifdef mxTrace
2995
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
2996
#endif
2997
109M
      mxBreak;
2998
109M
    mxCase(XS_CODE_INTEGER_2)
2999
13.6M
      mxPushKind(XS_INTEGER_KIND);
3000
13.6M
      mxStack->value.integer = mxRunS2(1);
3001
13.6M
      mxNextCode(3);
3002
#ifdef mxTrace
3003
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
3004
#endif
3005
13.6M
      mxBreak;
3006
13.6M
    mxCase(XS_CODE_INTEGER_4)
3007
8.52M
      mxPushKind(XS_INTEGER_KIND);
3008
8.52M
      mxStack->value.integer = mxRunS4(1);
3009
8.52M
      mxNextCode(5);
3010
#ifdef mxTrace
3011
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
3012
#endif
3013
8.52M
      mxBreak;
3014
16.3M
    mxCase(XS_CODE_NUMBER)
3015
16.3M
      mxPushKind(XS_NUMBER_KIND);
3016
16.3M
      {
3017
16.3M
        txByte* number = (txByte*)&(mxStack->value.number);
3018
      #if mxBigEndian
3019
        number[7] = mxCode[1];
3020
        number[6] = mxCode[2];
3021
        number[5] = mxCode[3];
3022
        number[4] = mxCode[4];
3023
        number[3] = mxCode[5];
3024
        number[2] = mxCode[6];
3025
        number[1] = mxCode[7];
3026
        number[0] = mxCode[8];
3027
      #else
3028
16.3M
        number[0] = mxCode[1];
3029
16.3M
        number[1] = mxCode[2];
3030
16.3M
        number[2] = mxCode[3];
3031
16.3M
        number[3] = mxCode[4];
3032
16.3M
        number[4] = mxCode[5];
3033
16.3M
        number[5] = mxCode[6];
3034
16.3M
        number[6] = mxCode[7];
3035
16.3M
        number[7] = mxCode[8];
3036
16.3M
      #endif
3037
16.3M
      }
3038
16.3M
      mxNextCode(9);
3039
#ifdef mxTrace
3040
      if (gxDoTrace) fxTraceNumber(the, mxStack->value.number);
3041
#endif
3042
16.3M
      mxBreak;
3043
      
3044
16.3M
    mxCase(XS_CODE_STRING_4)
3045
0
      index = mxRunS4(1);
3046
0
      mxSkipCode(5);
3047
0
      goto XS_CODE_STRING;
3048
2.89M
    mxCase(XS_CODE_STRING_2)
3049
2.89M
      index = mxRunU2(1);
3050
2.89M
      mxSkipCode(3);
3051
2.89M
      goto XS_CODE_STRING;
3052
17.1M
    mxCase(XS_CODE_STRING_1)
3053
17.1M
      index = mxRunU1(1);
3054
17.1M
      mxSkipCode(2);
3055
20.0M
    XS_CODE_STRING:
3056
20.0M
      mxSaveState;
3057
20.0M
      scratch.value.string = (txString)fxNewChunk(the, index);
3058
20.0M
      mxRestoreState;
3059
20.0M
      c_memcpy(scratch.value.string, mxCode, index);
3060
20.0M
      mxPushKind(XS_STRING_KIND);
3061
20.0M
      mxStack->value.string = scratch.value.string;
3062
20.0M
      mxNextCode(index);
3063
#ifdef mxTrace
3064
      if (gxDoTrace) fxTraceString(the, mxStack->value.string);
3065
#endif
3066
20.0M
      mxBreak;
3067
20.0M
    mxCase(XS_CODE_STRING_ARCHIVE_4)
3068
0
      index = mxRunS4(1);
3069
0
      mxSkipCode(5);
3070
0
      goto XS_CODE_STRING_ARCHIVE;
3071
0
    mxCase(XS_CODE_STRING_ARCHIVE_2)
3072
0
      index = mxRunU2(1);
3073
0
      mxSkipCode(3);
3074
0
      goto XS_CODE_STRING_ARCHIVE;
3075
0
    mxCase(XS_CODE_STRING_ARCHIVE_1)
3076
0
      index = mxRunU1(1);
3077
0
      mxSkipCode(2);
3078
0
    XS_CODE_STRING_ARCHIVE:
3079
0
      mxPushKind(XS_STRING_X_KIND);
3080
0
      mxStack->value.string = (txString)mxCode;
3081
0
      mxNextCode(index);
3082
#ifdef mxTrace
3083
      if (gxDoTrace) fxTraceString(the, mxStack->value.string);
3084
#endif
3085
0
      mxBreak;
3086
359k
    mxCase(XS_CODE_TO_STRING)
3087
359k
      mxToString(mxStack);
3088
359k
      mxNextCode(1);
3089
359k
      mxBreak;
3090
      
3091
359k
    mxCase(XS_CODE_SYMBOL)
3092
1.19k
      mxPushKind(XS_SYMBOL_KIND);
3093
1.19k
      mxStack->value.symbol = mxRunID(1);
3094
#ifdef mxTrace
3095
      if (gxDoTrace) fxTraceID(the, mxStack->value.symbol, 0);
3096
#endif
3097
1.19k
      mxNextCode(1 + sizeof(txID));
3098
1.19k
      mxBreak;
3099
      
3100
1.19k
    mxCase(XS_CODE_BIGINT_2)
3101
3
      index = mxRunU2(1);
3102
3
      mxSkipCode(3);
3103
3
      goto XS_CODE_BIGINT;
3104
9.39M
    mxCase(XS_CODE_BIGINT_1)
3105
9.39M
      index = mxRunU1(1);
3106
9.39M
      mxSkipCode(2);
3107
9.39M
    XS_CODE_BIGINT:
3108
9.39M
      mxSaveState;
3109
9.39M
      gxTypeBigInt.decode(the, index);
3110
9.39M
      mxRestoreState;
3111
9.39M
      mxNextCode(index);
3112
9.39M
      mxBreak;
3113
3114
  /* EXPRESSIONS */ 
3115
9.39M
    mxCase(XS_CODE_BIT_NOT)
3116
3.44M
      if (mxStack->kind == XS_INTEGER_KIND)
3117
2.06M
        mxStack->value.integer = ~mxStack->value.integer;
3118
1.38M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3119
611k
        mxStack->kind = XS_INTEGER_KIND;
3120
611k
        mxStack->value.integer = ~fxNumberToInteger(mxStack->value.number);
3121
611k
        mxFloatingPointOp("not");
3122
611k
      }
3123
769k
      else {
3124
769k
        mxSaveState;
3125
769k
        if (fxToNumericIntegerUnary(the, mxStack, gxTypeBigInt._not))
3126
492k
          mxStack->value.integer = ~mxStack->value.integer;
3127
769k
        mxRestoreState;
3128
769k
      }
3129
3.44M
      mxNextCode(1);
3130
3.44M
      mxBreak;
3131
3.59M
    mxCase(XS_CODE_BIT_AND)
3132
3.59M
      slot = mxStack + 1;
3133
3.59M
      if (slot->kind == XS_INTEGER_KIND) {
3134
2.02M
        if (mxStack->kind == XS_INTEGER_KIND)
3135
1.23M
          slot->value.integer &= mxStack->value.integer;
3136
782k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3137
543k
          slot->value.integer &= fxNumberToInteger(mxStack->value.number);
3138
543k
          mxFloatingPointOp("and");
3139
543k
        }
3140
238k
        else
3141
238k
          goto XS_CODE_BIT_AND_GENERAL;
3142
2.02M
      }
3143
1.57M
      else if (slot->kind == XS_NUMBER_KIND) {
3144
135k
        if (mxStack->kind == XS_INTEGER_KIND) {
3145
80.6k
          slot->kind = XS_INTEGER_KIND;
3146
80.6k
          slot->value.integer = fxNumberToInteger(slot->value.number) & mxStack->value.integer;
3147
80.6k
          mxFloatingPointOp("and");
3148
80.6k
        }
3149
55.3k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3150
46.2k
          slot->kind = XS_INTEGER_KIND;
3151
46.2k
          slot->value.integer = fxNumberToInteger(slot->value.number) & fxNumberToInteger(mxStack->value.number);
3152
46.2k
          mxFloatingPointOp("and");
3153
46.2k
        }
3154
9.03k
        else
3155
9.03k
          goto XS_CODE_BIT_AND_GENERAL;
3156
135k
      }
3157
1.43M
      else {
3158
1.68M
    XS_CODE_BIT_AND_GENERAL:
3159
1.68M
        mxSaveState;
3160
1.68M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._and))
3161
1.67M
          slot->value.integer &= mxStack->value.integer;
3162
1.68M
        mxRestoreState;
3163
1.68M
      }
3164
3.59M
      mxStack++;
3165
3.59M
      mxNextCode(1);
3166
3.59M
      mxBreak;
3167
5.57M
    mxCase(XS_CODE_BIT_OR)
3168
5.57M
      slot = mxStack + 1;
3169
5.57M
      if (slot->kind == XS_INTEGER_KIND) {
3170
3.80M
        if (mxStack->kind == XS_INTEGER_KIND)
3171
2.81M
          slot->value.integer |= mxStack->value.integer;
3172
995k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3173
594k
          slot->value.integer |= fxNumberToInteger(mxStack->value.number);
3174
594k
          mxFloatingPointOp("or");
3175
594k
        }
3176
400k
        else
3177
400k
          goto XS_CODE_BIT_OR_GENERAL;
3178
3.80M
      }
3179
1.76M
      else if (slot->kind == XS_NUMBER_KIND) {
3180
840k
        if (mxStack->kind == XS_INTEGER_KIND) {
3181
822k
          slot->kind = XS_INTEGER_KIND;
3182
822k
          slot->value.integer = fxNumberToInteger(slot->value.number) | mxStack->value.integer;
3183
822k
          mxFloatingPointOp("or");
3184
822k
        }
3185
17.9k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3186
1.30k
          slot->kind = XS_INTEGER_KIND;
3187
1.30k
          slot->value.integer = fxNumberToInteger(slot->value.number) | fxNumberToInteger(mxStack->value.number);
3188
1.30k
          mxFloatingPointOp("or");
3189
1.30k
        }
3190
16.6k
        else
3191
16.6k
          goto XS_CODE_BIT_OR_GENERAL;
3192
840k
      }
3193
926k
      else {
3194
1.34M
    XS_CODE_BIT_OR_GENERAL:
3195
1.34M
        mxSaveState;
3196
1.34M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._or))
3197
958k
          slot->value.integer |= mxStack->value.integer;
3198
1.34M
        mxRestoreState;
3199
1.34M
      }
3200
5.57M
      mxStack++;
3201
5.57M
      mxNextCode(1);
3202
5.57M
      mxBreak;
3203
5.57M
    mxCase(XS_CODE_BIT_XOR)
3204
2.14M
      slot = mxStack + 1;
3205
2.14M
      if (slot->kind == XS_INTEGER_KIND) {
3206
896k
        if (mxStack->kind == XS_INTEGER_KIND)
3207
634k
          slot->value.integer ^= mxStack->value.integer;
3208
262k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3209
86.9k
          slot->value.integer ^= fxNumberToInteger(mxStack->value.number);
3210
86.9k
          mxFloatingPointOp("xor");
3211
86.9k
        }
3212
175k
        else
3213
175k
          goto XS_CODE_BIT_XOR_GENERAL;
3214
896k
      }
3215
1.24M
      else if (slot->kind == XS_NUMBER_KIND) {
3216
61.2k
        if (mxStack->kind == XS_INTEGER_KIND) {
3217
60.8k
          slot->kind = XS_INTEGER_KIND;
3218
60.8k
          slot->value.integer = fxNumberToInteger(slot->value.number) ^ mxStack->value.integer;
3219
60.8k
          mxFloatingPointOp("xor");
3220
60.8k
        }
3221
401
        else if (mxStack->kind == XS_NUMBER_KIND) {
3222
145
          slot->kind = XS_INTEGER_KIND;
3223
145
          slot->value.integer = fxNumberToInteger(slot->value.number) ^ fxNumberToInteger(mxStack->value.number);
3224
145
          mxFloatingPointOp("xor");
3225
145
        }
3226
256
        else
3227
256
          goto XS_CODE_BIT_XOR_GENERAL;
3228
61.2k
      }
3229
1.18M
      else {
3230
1.36M
    XS_CODE_BIT_XOR_GENERAL:
3231
1.36M
        mxSaveState;
3232
1.36M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._xor))
3233
1.18M
          slot->value.integer ^= mxStack->value.integer;
3234
1.36M
        mxRestoreState;
3235
1.36M
      }
3236
2.14M
      mxStack++;
3237
2.14M
      mxNextCode(1);
3238
2.14M
      mxBreak;
3239
      
3240
2.14M
    mxCase(XS_CODE_LEFT_SHIFT)
3241
1.28M
      slot = mxStack + 1;
3242
1.28M
      if (slot->kind == XS_INTEGER_KIND) {
3243
902k
        if (mxStack->kind == XS_INTEGER_KIND)
3244
827k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (mxStack->value.integer & 0x1f));
3245
74.4k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3246
26.8k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (fxNumberToInteger(mxStack->value.number) & 0x1f));
3247
26.8k
          mxFloatingPointOp("left shift");
3248
26.8k
        }
3249
47.6k
        else
3250
47.6k
          goto XS_CODE_LEFT_SHIFT_GENERAL;
3251
902k
      }
3252
381k
      else if (slot->kind == XS_NUMBER_KIND) {
3253
366k
        if (mxStack->kind == XS_INTEGER_KIND) {
3254
198k
          slot->kind = XS_INTEGER_KIND;
3255
198k
          slot->value.integer = (txInteger)(((txUnsigned)fxNumberToInteger(slot->value.number)) << (mxStack->value.integer & 0x1f));
3256
198k
          mxFloatingPointOp("left shift");
3257
198k
        }
3258
168k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3259
39.9k
          slot->kind = XS_INTEGER_KIND;
3260
39.9k
          slot->value.integer = (txInteger)(((txUnsigned)fxNumberToInteger(slot->value.number)) << (fxNumberToInteger(mxStack->value.number) & 0x1f));
3261
39.9k
          mxFloatingPointOp("left shift");
3262
39.9k
        }
3263
128k
        else
3264
128k
          goto XS_CODE_LEFT_SHIFT_GENERAL;
3265
366k
      }
3266
15.3k
      else {
3267
191k
    XS_CODE_LEFT_SHIFT_GENERAL:
3268
191k
        mxSaveState;
3269
191k
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._lsl))
3270
187k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (mxStack->value.integer & 0x1f));
3271
191k
        mxRestoreState;
3272
191k
      }
3273
1.28M
      mxStack++;
3274
1.28M
      mxNextCode(1);
3275
1.28M
      mxBreak;
3276
2.55M
    mxCase(XS_CODE_SIGNED_RIGHT_SHIFT)
3277
2.55M
      slot = mxStack + 1;
3278
2.55M
      if (slot->kind == XS_INTEGER_KIND) {
3279
1.42M
        if (mxStack->kind == XS_INTEGER_KIND)
3280
696k
          slot->value.integer >>= mxStack->value.integer & 0x1f;
3281
731k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3282
141k
          slot->value.integer >>= fxNumberToInteger(mxStack->value.number) & 0x1f;
3283
141k
          mxFloatingPointOp("signed right shift");
3284
141k
        }
3285
590k
        else
3286
590k
          goto XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL;
3287
1.42M
      }
3288
1.12M
      else if (slot->kind == XS_NUMBER_KIND) {
3289
1.00M
        if (mxStack->kind == XS_INTEGER_KIND) {
3290
591k
          slot->kind = XS_INTEGER_KIND;
3291
591k
          slot->value.integer = fxNumberToInteger(slot->value.number) >> (mxStack->value.integer & 0x1f);
3292
591k
          mxFloatingPointOp("signed right shift");
3293
591k
        }
3294
417k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3295
415k
          slot->kind = XS_INTEGER_KIND;
3296
415k
          slot->value.integer = fxNumberToInteger(slot->value.number) >> (fxNumberToInteger(mxStack->value.number) & 0x1f);
3297
415k
          mxFloatingPointOp("signed right shift");
3298
415k
        }
3299
1.95k
        else
3300
1.95k
          goto XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL;
3301
1.00M
      }
3302
119k
      else {
3303
711k
    XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL:
3304
711k
        mxSaveState;
3305
711k
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._lsr))
3306
688k
          slot->value.integer >>= mxStack->value.integer & 0x1f;
3307
711k
        mxRestoreState;
3308
711k
      }
3309
2.55M
      mxStack++;
3310
2.55M
      mxNextCode(1);
3311
2.55M
      mxBreak;
3312
2.55M
    mxCase(XS_CODE_UNSIGNED_RIGHT_SHIFT)
3313
1.65M
      slot = mxStack + 1;
3314
1.65M
      if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND)) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND))) {
3315
1.26M
        fxUnsigned(the, slot, fxToUnsigned(the, slot) >> (fxToUnsigned(the, mxStack) & 0x1F));
3316
1.26M
      }
3317
392k
      else {
3318
392k
        mxSaveState;
3319
392k
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._nop))
3320
392k
          fxUnsigned(the, slot, fxToUnsigned(the, slot) >> (fxToUnsigned(the, mxStack) & 0x1F));
3321
392k
        mxRestoreState;
3322
392k
      }
3323
1.65M
      mxStack++;
3324
1.65M
      mxNextCode(1);
3325
1.65M
      mxBreak;
3326
        
3327
19.5M
    mxCase(XS_CODE_MINUS)
3328
19.5M
      if (mxStack->kind == XS_INTEGER_KIND) {
3329
9.87M
        if (mxStack->value.integer & 0x7FFFFFFF)
3330
6.62M
          mxStack->value.integer = -mxStack->value.integer;
3331
3.24M
        else {
3332
3.24M
          mxStack->kind = XS_NUMBER_KIND;
3333
3.24M
          mxStack->value.number = -((txNumber)(mxStack->value.integer));
3334
3.24M
          mxFloatingPointOp("minus");
3335
3.24M
        }
3336
9.87M
      }
3337
9.69M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3338
1.75M
        mxStack->value.number = -mxStack->value.number;
3339
1.75M
        mxFloatingPointOp("minus");
3340
1.75M
      }
3341
7.94M
      else {
3342
7.94M
        mxSaveState;
3343
7.94M
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._neg)) {
3344
2.71M
          mxStack->value.number = -mxStack->value.number;
3345
2.71M
          mxFloatingPointOp("minus");
3346
2.71M
        }
3347
7.94M
        mxRestoreState;
3348
7.94M
      }
3349
19.5M
      mxNextCode(1);
3350
19.5M
      mxBreak;
3351
19.5M
    mxCase(XS_CODE_PLUS)
3352
5.77M
      if (mxStack->kind != XS_INTEGER_KIND) {
3353
1.95M
        mxToNumber(mxStack);
3354
1.95M
      }
3355
5.77M
      mxNextCode(1);
3356
5.77M
      mxBreak;
3357
      
3358
5.77M
    mxCase(XS_CODE_TO_NUMERIC)
3359
3.38M
      if ((mxStack->kind != XS_INTEGER_KIND) && (mxStack->kind != XS_NUMBER_KIND)) {
3360
1.49M
        mxSaveState;
3361
1.49M
        fxToNumericNumber(the, mxStack);
3362
1.49M
        mxRestoreState;
3363
1.49M
      }
3364
3.38M
      mxNextCode(1);
3365
3.38M
      mxBreak;
3366
3.86M
    mxCase(XS_CODE_DECREMENT)
3367
3.86M
      if (mxStack->kind == XS_INTEGER_KIND) {
3368
1.03M
        if (mxStack->value.integer != -2147483647)
3369
1.03M
          mxStack->value.integer--;
3370
0
        else {
3371
0
          mxStack->kind = XS_NUMBER_KIND;
3372
0
          mxStack->value.number = mxStack->value.integer;
3373
0
          mxStack->value.number--;
3374
0
          mxFloatingPointOp("decrement");
3375
0
        }
3376
1.03M
      }
3377
2.83M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3378
2.42M
        mxStack->value.number--;
3379
2.42M
        mxFloatingPointOp("decrement");
3380
2.42M
      }
3381
403k
      else {
3382
403k
        mxSaveState;
3383
403k
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._dec)) {
3384
403k
          mxStack->value.number--;
3385
403k
          mxFloatingPointOp("decrement");
3386
403k
        }
3387
403k
        mxRestoreState;
3388
403k
      }
3389
3.86M
      mxNextCode(1);
3390
3.86M
      mxBreak;
3391
29.8M
    mxCase(XS_CODE_INCREMENT)
3392
29.8M
      if (mxStack->kind == XS_INTEGER_KIND) {
3393
19.1M
        if (mxStack->value.integer != 2147483647)
3394
19.1M
          mxStack->value.integer++;
3395
270
        else {
3396
270
          mxStack->kind = XS_NUMBER_KIND;
3397
270
          mxStack->value.number = mxStack->value.integer;
3398
270
          mxStack->value.number++;
3399
270
          mxFloatingPointOp("increment");
3400
270
        }
3401
19.1M
      }
3402
10.6M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3403
7.08M
        mxStack->value.number++;
3404
7.08M
        mxFloatingPointOp("increment");
3405
7.08M
      }
3406
3.60M
      else {
3407
3.60M
        mxSaveState;
3408
3.60M
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._inc)) {
3409
2.51M
          mxStack->value.number++;
3410
2.51M
          mxFloatingPointOp("increment");
3411
2.51M
        }
3412
3.60M
        mxRestoreState;
3413
3.60M
      }
3414
29.8M
      mxNextCode(1);
3415
29.8M
      mxBreak;
3416
      
3417
29.8M
    mxCase(XS_CODE_ADD)
3418
12.4M
      slot = mxStack + 1;
3419
12.4M
      if (slot->kind == XS_INTEGER_KIND) {
3420
6.55M
        if (mxStack->kind == XS_INTEGER_KIND) {
3421
5.13M
          #if __has_builtin(__builtin_add_overflow)
3422
5.13M
            if (__builtin_add_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3423
2.11k
              slot->kind = XS_NUMBER_KIND;
3424
2.11k
              slot->value.number = (txNumber)(slot->value.integer) + (txNumber)(mxStack->value.integer);
3425
2.11k
              mxFloatingPointOp("add");
3426
2.11k
            }
3427
5.13M
            else
3428
5.13M
              slot->value.integer = scratch.value.integer;
3429
          #else
3430
            txInteger a = slot->value.integer;
3431
            txInteger b = mxStack->value.integer;
3432
            txInteger c = a + b;
3433
            if (((a ^ c) & (b ^ c)) < 0) {
3434
              slot->kind = XS_NUMBER_KIND;
3435
              slot->value.number = (txNumber)(slot->value.integer) + (txNumber)(mxStack->value.integer);
3436
              mxFloatingPointOp("add");
3437
            }
3438
            else
3439
              slot->value.integer = c;
3440
          #endif
3441
5.13M
        }
3442
1.42M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3443
1.05M
          slot->kind = XS_NUMBER_KIND;
3444
1.05M
          slot->value.number = (txNumber)(slot->value.integer) + mxStack->value.number;
3445
1.05M
          mxFloatingPointOp("add");
3446
1.05M
        }
3447
366k
        else
3448
366k
          goto XS_CODE_ADD_GENERAL;
3449
6.55M
      }
3450
5.86M
      else if (slot->kind == XS_NUMBER_KIND) {
3451
2.48M
        if (mxStack->kind == XS_INTEGER_KIND) {
3452
1.18M
          slot->value.number += (txNumber)(mxStack->value.integer);
3453
1.18M
          mxFloatingPointOp("add");
3454
1.18M
        }
3455
1.30M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3456
970k
          slot->value.number += mxStack->value.number;
3457
970k
          mxFloatingPointOp("add");
3458
970k
        }
3459
330k
        else
3460
330k
          goto XS_CODE_ADD_GENERAL;
3461
2.48M
      }
3462
3.38M
      else {
3463
4.07M
    XS_CODE_ADD_GENERAL:
3464
4.07M
        mxSaveState;
3465
4.07M
        fxToPrimitive(the, slot, XS_NO_HINT);
3466
4.07M
        fxToPrimitive(the, mxStack, XS_NO_HINT);
3467
4.07M
        if ((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND) || (mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)) {
3468
3.65M
          fxToString(the, slot);
3469
3.65M
          fxToString(the, mxStack);
3470
3.65M
          fxConcatString(the, slot, mxStack);
3471
3.65M
        }
3472
420k
        else {
3473
420k
          if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._add)) {
3474
402k
            slot->value.number += mxStack->value.number;
3475
402k
            mxFloatingPointOp("add");
3476
402k
          }
3477
420k
        }
3478
4.07M
        mxRestoreState;
3479
4.07M
      }
3480
12.4M
      mxStack++;
3481
12.4M
      mxNextCode(1);
3482
12.4M
      mxBreak;
3483
13.7M
    mxCase(XS_CODE_SUBTRACT)
3484
13.7M
      slot = mxStack + 1;
3485
13.7M
      if (slot->kind == XS_INTEGER_KIND) {
3486
7.77M
        if (mxStack->kind == XS_INTEGER_KIND) {
3487
4.71M
          #if __has_builtin(__builtin_sub_overflow)
3488
4.71M
            if (__builtin_sub_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3489
1.37k
              slot->kind = XS_NUMBER_KIND;
3490
1.37k
              slot->value.number = (txNumber)(slot->value.integer) - (txNumber)(mxStack->value.integer);
3491
1.37k
              mxFloatingPointOp("subtract");
3492
1.37k
            }
3493
4.71M
            else
3494
4.71M
              slot->value.integer = scratch.value.integer;
3495
          #else
3496
            txInteger a = slot->value.integer;
3497
            txInteger b = -mxStack->value.integer;
3498
            txInteger c = a + b;
3499
            if (((a ^ c) & (b ^ c)) < 0) {
3500
              slot->kind = XS_NUMBER_KIND;
3501
              slot->value.number = (txNumber)(slot->value.integer) - (txNumber)(mxStack->value.integer);
3502
              mxFloatingPointOp("subtract");
3503
            }
3504
            else
3505
              slot->value.integer = c;
3506
          #endif
3507
4.71M
        }
3508
3.05M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3509
1.92M
          slot->kind = XS_NUMBER_KIND;
3510
1.92M
          slot->value.number = (txNumber)(slot->value.integer) - mxStack->value.number;
3511
1.92M
          mxFloatingPointOp("subtract");
3512
1.92M
        }
3513
1.12M
        else
3514
1.12M
          goto XS_CODE_SUBTRACT_GENERAL;
3515
7.77M
      }
3516
5.94M
      else if (slot->kind == XS_NUMBER_KIND) {
3517
4.01M
        if (mxStack->kind == XS_INTEGER_KIND) {
3518
529k
          slot->value.number -= (txNumber)(mxStack->value.integer);
3519
529k
          mxFloatingPointOp("subtract");
3520
529k
        }
3521
3.48M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3522
3.30M
          slot->value.number -= mxStack->value.number;
3523
3.30M
          mxFloatingPointOp("subtract");
3524
3.30M
        }
3525
180k
        else
3526
180k
          goto XS_CODE_SUBTRACT_GENERAL;
3527
4.01M
      }
3528
1.92M
      else {
3529
3.23M
    XS_CODE_SUBTRACT_GENERAL:
3530
3.23M
        mxSaveState;
3531
3.23M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._sub)) {
3532
3.17M
          slot->value.number -= mxStack->value.number;
3533
3.17M
          mxFloatingPointOp("subtract");
3534
3.17M
        }
3535
3.23M
        mxRestoreState;
3536
3.23M
      }
3537
13.7M
      mxStack++;
3538
13.7M
      mxNextCode(1);
3539
13.7M
      mxBreak;
3540
      
3541
13.7M
    mxCase(XS_CODE_DIVIDE)
3542
7.54M
      slot = mxStack + 1;
3543
7.54M
      if (slot->kind == XS_INTEGER_KIND) {
3544
4.68M
        if (mxStack->kind == XS_INTEGER_KIND) {
3545
3.79M
          slot->kind = XS_NUMBER_KIND;
3546
3.79M
          slot->value.number = (txNumber)(slot->value.integer) / (txNumber)(mxStack->value.integer);
3547
3.79M
        }
3548
892k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3549
495k
          slot->kind = XS_NUMBER_KIND;
3550
495k
          slot->value.number = (txNumber)(slot->value.integer) / mxStack->value.number;
3551
495k
        }
3552
397k
        else
3553
397k
          goto XS_CODE_DIVIDE_GENERAL;
3554
4.68M
      }
3555
2.86M
      else if (slot->kind == XS_NUMBER_KIND) {
3556
1.92M
        if (mxStack->kind == XS_INTEGER_KIND)
3557
1.04M
          slot->value.number /= (txNumber)(mxStack->value.integer);
3558
873k
        else if (mxStack->kind == XS_NUMBER_KIND)
3559
411k
          slot->value.number /= mxStack->value.number;
3560
462k
        else
3561
462k
          goto XS_CODE_DIVIDE_GENERAL;
3562
1.92M
      }
3563
942k
      else {
3564
1.80M
    XS_CODE_DIVIDE_GENERAL:
3565
1.80M
        mxSaveState;
3566
1.80M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._div))
3567
1.78M
          slot->value.number /= mxStack->value.number;
3568
1.80M
        mxRestoreState;
3569
1.80M
      }
3570
7.54M
      mxFloatingPointOp("divide");
3571
7.54M
      mxStack++;
3572
7.54M
      mxNextCode(1);
3573
7.54M
      mxBreak;
3574
7.54M
    mxCase(XS_CODE_EXPONENTIATION)
3575
3.12M
      slot = mxStack + 1;
3576
3.12M
      if (slot->kind == XS_INTEGER_KIND) {
3577
1.60M
        if (mxStack->kind == XS_INTEGER_KIND) {
3578
363k
          slot->kind = XS_NUMBER_KIND;
3579
363k
          slot->value.number = fx_pow((txNumber)(slot->value.integer), (txNumber)(mxStack->value.integer));
3580
363k
        }
3581
1.23M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3582
621k
          slot->kind = XS_NUMBER_KIND;
3583
621k
          slot->value.number = fx_pow((txNumber)(slot->value.integer), mxStack->value.number);
3584
621k
        }
3585
617k
        else
3586
617k
          goto XS_CODE_EXPONENTIATION_GENERAL;
3587
1.60M
      }
3588
1.52M
      else if (slot->kind == XS_NUMBER_KIND) {
3589
1.40M
        if (mxStack->kind == XS_INTEGER_KIND)
3590
293k
          slot->value.number = fx_pow(slot->value.number, (txNumber)(mxStack->value.integer));
3591
1.11M
        else if (mxStack->kind == XS_NUMBER_KIND)
3592
522k
          slot->value.number = fx_pow(slot->value.number, mxStack->value.number);
3593
589k
        else
3594
589k
          goto XS_CODE_EXPONENTIATION_GENERAL;
3595
1.40M
      }
3596
120k
      else {
3597
1.32M
    XS_CODE_EXPONENTIATION_GENERAL:
3598
1.32M
        mxSaveState;
3599
1.32M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._exp))
3600
1.27M
          slot->value.number = fx_pow(slot->value.number, mxStack->value.number);
3601
1.32M
        mxRestoreState;
3602
1.32M
      }
3603
3.12M
      mxFloatingPointOp("exponent");
3604
3.12M
      mxStack++;
3605
3.12M
      mxNextCode(1);
3606
3.12M
      mxBreak;
3607
3.12M
    mxCase(XS_CODE_MULTIPLY)
3608
2.56M
      slot = mxStack + 1;
3609
2.56M
      if (slot->kind == XS_INTEGER_KIND) {
3610
1.31M
        if (mxStack->kind == XS_INTEGER_KIND) {
3611
748k
        #ifdef mxMinusZero
3612
748k
          if (slot->value.integer == 0) {
3613
344k
            if (mxStack->value.integer < 0) {
3614
4.95k
              slot->kind = XS_NUMBER_KIND;
3615
4.95k
              slot->value.number = -0.0;
3616
4.95k
            }
3617
344k
          }
3618
404k
          else if (mxStack->value.integer == 0) {
3619
19.7k
            if (slot->value.integer < 0) {
3620
3.94k
              slot->kind = XS_NUMBER_KIND;
3621
3.94k
              slot->value.number = -0.0;
3622
3.94k
            }
3623
15.7k
            else
3624
15.7k
              slot->value.integer = 0;
3625
19.7k
          }
3626
384k
          else {
3627
384k
        #endif
3628
384k
          #if __has_builtin(__builtin_mul_overflow)
3629
384k
            if (__builtin_mul_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3630
142k
              slot->kind = XS_NUMBER_KIND;
3631
142k
              slot->value.number = (txNumber)(slot->value.integer) * (txNumber)(mxStack->value.integer);
3632
142k
              mxFloatingPointOp("multiply");
3633
142k
            }
3634
242k
            else
3635
242k
              slot->value.integer = scratch.value.integer;
3636
          #else
3637
            slot->kind = XS_NUMBER_KIND;
3638
            slot->value.number = (txNumber)(slot->value.integer) * (txNumber)(mxStack->value.integer);
3639
            mxFloatingPointOp("multiply");
3640
          #endif
3641
384k
        #ifdef mxMinusZero
3642
384k
          }
3643
748k
        #endif
3644
748k
        }
3645
563k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3646
274k
          slot->kind = XS_NUMBER_KIND;
3647
274k
          slot->value.number = (txNumber)(slot->value.integer) * mxStack->value.number;
3648
274k
          mxFloatingPointOp("multiply");
3649
274k
        }
3650
289k
        else
3651
289k
          goto XS_CODE_MULTIPLY_GENERAL;
3652
1.31M
      }
3653
1.25M
      else if (slot->kind == XS_NUMBER_KIND) {
3654
1.08M
        if (mxStack->kind == XS_INTEGER_KIND) {
3655
358k
          slot->value.number *= (txNumber)(mxStack->value.integer);
3656
358k
          mxFloatingPointOp("multiply");
3657
358k
        }
3658
729k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3659
434k
          slot->value.number *= mxStack->value.number;
3660
434k
          mxFloatingPointOp("multiply");
3661
434k
        }
3662
295k
        else
3663
295k
          goto XS_CODE_MULTIPLY_GENERAL;
3664
1.08M
      }
3665
168k
      else {
3666
752k
    XS_CODE_MULTIPLY_GENERAL:
3667
752k
        mxSaveState;
3668
752k
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._mul))
3669
631k
          slot->value.number *= mxStack->value.number;
3670
752k
        mxRestoreState;
3671
752k
      }
3672
2.56M
      mxStack++;
3673
2.56M
      mxNextCode(1);
3674
2.56M
      mxBreak;
3675
8.31M
    mxCase(XS_CODE_MODULO)
3676
8.31M
      slot = mxStack + 1;
3677
8.31M
      if (slot->kind == XS_INTEGER_KIND) {
3678
3.78M
        if (mxStack->kind == XS_INTEGER_KIND) {
3679
2.86M
          if (mxStack->value.integer == 0) {
3680
691k
            slot->kind = XS_NUMBER_KIND;
3681
691k
            slot->value.number = C_NAN;
3682
691k
          }
3683
2.17M
        #if mxIntegerDivideOverflowException
3684
2.17M
          else if ((-1 == mxStack->value.integer) && ((txInteger)0x80000000 == slot->value.integer)) {
3685
2
            slot->kind = XS_NUMBER_KIND;
3686
2
            slot->value.number = -0.0;
3687
2
          }
3688
2.17M
        #endif 
3689
2.17M
        #ifdef mxMinusZero
3690
2.17M
          else if (slot->value.integer < 0) {
3691
263k
            slot->value.integer %= mxStack->value.integer;
3692
263k
            if (slot->value.integer == 0) {
3693
4.97k
              slot->kind = XS_NUMBER_KIND;
3694
4.97k
              slot->value.number = -0.0;
3695
4.97k
            }
3696
263k
          }
3697
1.90M
        #endif
3698
1.90M
          else
3699
1.90M
            slot->value.integer %= mxStack->value.integer;
3700
2.86M
        }
3701
925k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3702
862k
          slot->kind = XS_NUMBER_KIND;
3703
862k
          slot->value.number = c_fmod((txNumber)(slot->value.integer), mxStack->value.number);
3704
862k
          mxFloatingPointOp("modulo");
3705
862k
        }
3706
63.2k
        else
3707
63.2k
          goto XS_CODE_MODULO_GENERAL;
3708
3.78M
      }
3709
4.52M
      else if (slot->kind == XS_NUMBER_KIND) {
3710
2.26M
        if (mxStack->kind == XS_INTEGER_KIND) {
3711
752k
          slot->value.number = c_fmod(slot->value.number, (txNumber)(mxStack->value.integer));
3712
752k
          mxFloatingPointOp("modulo");
3713
752k
        }
3714
1.50M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3715
862k
          slot->value.number = c_fmod(slot->value.number, mxStack->value.number);
3716
862k
          mxFloatingPointOp("modulo");
3717
862k
        }
3718
646k
        else
3719
646k
          goto XS_CODE_MODULO_GENERAL;
3720
2.26M
      }
3721
2.26M
      else {
3722
2.97M
    XS_CODE_MODULO_GENERAL:
3723
2.97M
        mxSaveState;
3724
2.97M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._rem)) {
3725
2.26M
          slot->value.number = c_fmod(slot->value.number, mxStack->value.number);
3726
2.26M
          mxFloatingPointOp("modulo");
3727
2.26M
        }
3728
2.97M
        mxRestoreState;
3729
2.97M
      }
3730
8.31M
      mxStack++;
3731
8.31M
      mxNextCode(1);
3732
8.31M
      mxBreak;
3733
      
3734
8.31M
    mxCase(XS_CODE_NOT)
3735
6.32M
      mxToBoolean(mxStack);
3736
6.32M
      mxStack->value.boolean = !mxStack->value.boolean;
3737
6.32M
      mxNextCode(1);
3738
6.32M
      mxBreak;
3739
19.3M
    mxCase(XS_CODE_LESS)
3740
19.3M
      slot = mxStack + 1;
3741
19.3M
      if (slot->kind == XS_INTEGER_KIND) {
3742
13.5M
        if (mxStack->kind == XS_INTEGER_KIND)
3743
10.2M
          offset = slot->value.integer < mxStack->value.integer;
3744
3.31M
        else if (mxStack->kind == XS_NUMBER_KIND)  {
3745
1.91M
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) < mxStack->value.number);
3746
1.91M
          mxFloatingPointOp("less");
3747
1.91M
        }
3748
1.39M
        else
3749
1.39M
          goto XS_CODE_LESS_GENERAL;
3750
13.5M
      }
3751
5.76M
      else if (slot->kind == XS_NUMBER_KIND) {
3752
2.97M
        if (mxStack->kind == XS_INTEGER_KIND) {
3753
2.07M
          offset = (!c_isnan(slot->value.number)) && (slot->value.number < (txNumber)(mxStack->value.integer));
3754
2.07M
          mxFloatingPointOp("less");
3755
2.07M
        }
3756
899k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3757
74.0k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number < mxStack->value.number);
3758
74.0k
          mxFloatingPointOp("less");
3759
74.0k
        }
3760
825k
        else
3761
825k
          goto XS_CODE_LESS_GENERAL;
3762
2.97M
      }
3763
2.78M
      else {
3764
5.00M
    XS_CODE_LESS_GENERAL:
3765
5.00M
        mxSaveState; 
3766
5.00M
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3767
5.00M
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3768
5.00M
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3769
75.8k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) < 0;
3770
4.93M
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3771
1.63M
          offset = gxTypeBigInt.compare(the, 1, 0, 0, slot, mxStack);
3772
3.29M
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3773
2.10M
          offset = gxTypeBigInt.compare(the, 0, 0, 1, mxStack, slot);
3774
1.18M
        else {
3775
1.18M
          fxToNumber(the, slot);
3776
1.18M
          fxToNumber(the, mxStack);
3777
1.18M
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number < mxStack->value.number);
3778
1.18M
          mxFloatingPointOp("less");
3779
1.18M
        }
3780
5.00M
        mxRestoreState;
3781
5.00M
      }
3782
19.3M
      slot->kind = XS_BOOLEAN_KIND;
3783
19.3M
      slot->value.boolean = offset;
3784
19.3M
      mxStack++;
3785
19.3M
      mxNextCode(1);
3786
19.3M
      mxBreak;
3787
19.3M
    mxCase(XS_CODE_LESS_EQUAL)
3788
1.29M
      slot = mxStack + 1;
3789
1.29M
      if (slot->kind == XS_INTEGER_KIND) {
3790
1.05M
        if (mxStack->kind == XS_INTEGER_KIND)
3791
832k
          offset = slot->value.integer <= mxStack->value.integer;
3792
225k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3793
81.3k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) <= mxStack->value.number);
3794
81.3k
          mxFloatingPointOp("less or equal");
3795
81.3k
        }
3796
143k
        else
3797
143k
          goto XS_CODE_LESS_EQUAL_GENERAL;
3798
1.05M
      }
3799
233k
      else if (slot->kind == XS_NUMBER_KIND) {
3800
186k
        if (mxStack->kind == XS_INTEGER_KIND) {
3801
109k
          offset = (!c_isnan(slot->value.number)) && (slot->value.number <= (txNumber)(mxStack->value.integer));
3802
109k
          mxFloatingPointOp("less or equal");
3803
109k
        }
3804
77.1k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3805
76.9k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number <= mxStack->value.number);
3806
76.9k
          mxFloatingPointOp("less or equal");
3807
76.9k
        }
3808
223
        else
3809
223
          goto XS_CODE_LESS_EQUAL_GENERAL;
3810
186k
      }
3811
47.2k
      else {
3812
191k
    XS_CODE_LESS_EQUAL_GENERAL:
3813
191k
        mxSaveState; 
3814
191k
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3815
191k
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3816
191k
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3817
5.39k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) <= 0;
3818
185k
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3819
271
          offset = gxTypeBigInt.compare(the, 1, 1, 0, slot, mxStack);
3820
185k
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3821
81.3k
          offset = gxTypeBigInt.compare(the, 0, 1, 1, mxStack, slot);
3822
104k
        else {
3823
104k
          fxToNumber(the, slot);
3824
104k
          fxToNumber(the, mxStack);
3825
104k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number <= mxStack->value.number);
3826
104k
          mxFloatingPointOp("less or equal");
3827
104k
        }
3828
191k
        mxRestoreState;
3829
191k
      }
3830
1.29M
      slot->kind = XS_BOOLEAN_KIND;
3831
1.29M
      slot->value.boolean = offset;
3832
1.29M
      mxStack++;
3833
1.29M
      mxNextCode(1);
3834
1.29M
      mxBreak;
3835
1.88M
    mxCase(XS_CODE_MORE)
3836
1.88M
      slot = mxStack + 1;
3837
1.88M
      if (slot->kind == XS_INTEGER_KIND) {
3838
1.16M
        if (mxStack->kind == XS_INTEGER_KIND)
3839
846k
          offset = slot->value.integer > mxStack->value.integer;
3840
318k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3841
258k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) > mxStack->value.number);
3842
258k
          mxFloatingPointOp("more");
3843
258k
        }
3844
60.2k
        else
3845
60.2k
          goto XS_CODE_MORE_GENERAL;
3846
1.16M
      }
3847
714k
      else if (slot->kind == XS_NUMBER_KIND) {
3848
280k
        if (mxStack->kind == XS_INTEGER_KIND) {
3849
118k
          offset = (!c_isnan(slot->value.number)) && (slot->value.number > (txNumber)(mxStack->value.integer));
3850
118k
          mxFloatingPointOp("more");
3851
118k
        }
3852
162k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3853
38.0k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number > mxStack->value.number);
3854
38.0k
          mxFloatingPointOp("more");
3855
38.0k
        }
3856
124k
        else
3857
124k
          goto XS_CODE_MORE_GENERAL;
3858
280k
      }
3859
434k
      else {
3860
618k
    XS_CODE_MORE_GENERAL:
3861
618k
        mxSaveState; 
3862
618k
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3863
618k
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3864
618k
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3865
2.29k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) > 0;
3866
616k
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3867
1.99k
          offset = gxTypeBigInt.compare(the, 0, 0, 1, slot, mxStack);
3868
614k
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3869
3.40k
          offset = gxTypeBigInt.compare(the, 1, 0, 0, mxStack, slot);
3870
611k
        else {
3871
611k
          fxToNumber(the, slot);
3872
611k
          fxToNumber(the, mxStack);
3873
611k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number > mxStack->value.number);
3874
611k
          mxFloatingPointOp("more");
3875
611k
        }
3876
618k
        mxRestoreState;
3877
618k
      }
3878
1.88M
      slot->kind = XS_BOOLEAN_KIND;
3879
1.88M
      slot->value.boolean = offset;
3880
1.88M
      mxStack++;
3881
1.88M
      mxNextCode(1);
3882
1.88M
      mxBreak;
3883
3.09M
    mxCase(XS_CODE_MORE_EQUAL)
3884
3.09M
      slot = mxStack + 1;
3885
3.09M
      if (slot->kind == XS_INTEGER_KIND) {
3886
861k
        if (mxStack->kind == XS_INTEGER_KIND)
3887
503k
          offset = slot->value.integer >= mxStack->value.integer;
3888
358k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3889
222k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) >= mxStack->value.number);
3890
222k
          mxFloatingPointOp("more or equal");
3891
222k
        }
3892
135k
        else
3893
135k
          goto XS_CODE_MORE_EQUAL_GENERAL;
3894
861k
      }
3895
2.22M
      else if (slot->kind == XS_NUMBER_KIND) {
3896
1.37M
        if (mxStack->kind == XS_INTEGER_KIND) {
3897
572k
          offset = (!c_isnan(slot->value.number)) && (slot->value.number >= (txNumber)(mxStack->value.integer));
3898
572k
          mxFloatingPointOp("more or equal");
3899
572k
        }
3900
806k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3901
676k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number >= mxStack->value.number);
3902
676k
          mxFloatingPointOp("more or equal");
3903
676k
        }
3904
130k
        else
3905
130k
          goto XS_CODE_MORE_EQUAL_GENERAL;
3906
1.37M
      }
3907
849k
      else {
3908
1.11M
    XS_CODE_MORE_EQUAL_GENERAL:
3909
1.11M
        mxSaveState; 
3910
1.11M
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3911
1.11M
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3912
1.11M
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3913
2.49k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) >= 0;
3914
1.11M
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3915
14.0k
          offset = gxTypeBigInt.compare(the, 0, 1, 1, slot, mxStack);
3916
1.09M
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3917
1.85k
          offset = gxTypeBigInt.compare(the, 1, 1, 0, mxStack, slot);
3918
1.09M
        else {
3919
1.09M
          fxToNumber(the, slot);
3920
1.09M
          fxToNumber(the, mxStack);
3921
1.09M
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number >= mxStack->value.number);
3922
1.09M
          mxFloatingPointOp("more or equal");
3923
1.09M
        }
3924
1.11M
        mxRestoreState;
3925
1.11M
      }
3926
3.09M
      slot->kind = XS_BOOLEAN_KIND;
3927
3.09M
      slot->value.boolean = offset;
3928
3.09M
      mxStack++;
3929
3.09M
      mxNextCode(1);
3930
3.09M
      mxBreak;
3931
3932
3.09M
    mxCase(XS_CODE_EQUAL)
3933
1.67M
    mxCase(XS_CODE_STRICT_EQUAL)
3934
1.67M
      slot = mxStack + 1;
3935
1.75M
    XS_CODE_EQUAL_AGAIN:
3936
1.75M
      if (slot->kind == mxStack->kind) {
3937
551k
        if ((XS_UNDEFINED_KIND == slot->kind) || (XS_NULL_KIND == slot->kind))
3938
134k
          offset = 1;
3939
416k
        else if (XS_BOOLEAN_KIND == slot->kind)
3940
10.0k
          offset = slot->value.boolean == stack->value.boolean;
3941
406k
        else if (XS_INTEGER_KIND == slot->kind)
3942
248k
          offset = slot->value.integer == stack->value.integer;
3943
157k
        else if (XS_NUMBER_KIND == slot->kind) {
3944
23.4k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number == mxStack->value.number);
3945
23.4k
          mxFloatingPointOp("equal");
3946
23.4k
        }
3947
134k
        else if ((XS_STRING_KIND == slot->kind) || (XS_STRING_X_KIND == slot->kind))
3948
47.5k
          offset = c_strcmp(slot->value.string, mxStack->value.string) == 0;
3949
86.8k
        else if (XS_SYMBOL_KIND == slot->kind)
3950
1.85k
          offset = slot->value.symbol == mxStack->value.symbol;
3951
85.0k
        else if (XS_REFERENCE_KIND == slot->kind)
3952
84.7k
          offset = fxIsSameReference(the, slot, mxStack);
3953
      #if mxHostFunctionPrimitive
3954
        else if (XS_HOST_FUNCTION_KIND == slot->kind)
3955
          offset = slot->value.hostFunction.builder == mxStack->value.hostFunction.builder;
3956
      #endif
3957
244
        else if ((XS_BIGINT_KIND == slot->kind) || (XS_BIGINT_X_KIND == slot->kind))
3958
244
          offset = gxTypeBigInt.compare(the, 0, 1, 0, slot, mxStack);
3959
0
        else
3960
0
                    offset = 0;
3961
551k
      }
3962
1.20M
      else if ((XS_INTEGER_KIND == slot->kind) && (XS_NUMBER_KIND == mxStack->kind)) {
3963
8.61k
        offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) == stack->value.number);
3964
8.61k
        mxFloatingPointOp("equal");
3965
8.61k
      }
3966
1.19M
      else if ((XS_NUMBER_KIND == slot->kind) && (XS_INTEGER_KIND == mxStack->kind)) {
3967
3.07k
        offset = (!c_isnan(slot->value.number)) && (slot->value.number == (txNumber)(mxStack->value.integer));
3968
3.07k
        mxFloatingPointOp("equal");
3969
3.07k
      }
3970
1.19M
      else if ((XS_STRING_KIND == slot->kind) && (XS_STRING_X_KIND == mxStack->kind))
3971
0
        offset = c_strcmp(slot->value.string, mxStack->value.string) == 0;
3972
1.19M
      else if ((XS_STRING_X_KIND == slot->kind) && (XS_STRING_KIND == mxStack->kind))
3973
0
        offset = c_strcmp(slot->value.string, mxStack->value.string) == 0;
3974
1.19M
      else if (XS_CODE_EQUAL == byte) {
3975
563k
        if ((slot->kind == XS_UNDEFINED_KIND) && (mxStack->kind == XS_NULL_KIND))
3976
1
          offset = 1;
3977
563k
        else if ((slot->kind == XS_NULL_KIND) && (mxStack->kind == XS_UNDEFINED_KIND))
3978
3
          offset = 1;
3979
563k
        else if (((XS_INTEGER_KIND == slot->kind) || (XS_NUMBER_KIND == slot->kind)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND))) {
3980
2.72k
          mxToNumber(mxStack); 
3981
2.72k
          goto XS_CODE_EQUAL_AGAIN;
3982
2.72k
        }
3983
561k
        else if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_INTEGER_KIND == mxStack->kind) || (XS_NUMBER_KIND == mxStack->kind))) {
3984
3.67k
          mxToNumber(slot);
3985
3.67k
          goto XS_CODE_EQUAL_AGAIN;
3986
3.67k
        }
3987
557k
        else if (XS_BOOLEAN_KIND == slot->kind) {
3988
59.8k
          mxToNumber(slot);
3989
59.8k
          goto XS_CODE_EQUAL_AGAIN;
3990
59.8k
        }
3991
497k
        else if (XS_BOOLEAN_KIND == mxStack->kind) {
3992
2.50k
          mxToNumber(mxStack);
3993
2.50k
          goto XS_CODE_EQUAL_AGAIN;
3994
2.50k
        }
3995
495k
        else if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND) || (slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND) || (slot->kind == XS_SYMBOL_KIND) || (slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND)) && mxIsReference(mxStack)) {
3996
1.47k
          mxSaveState;
3997
1.47k
          fxToPrimitive(the, mxStack, XS_NO_HINT);
3998
1.47k
          mxRestoreState;
3999
1.47k
          goto XS_CODE_EQUAL_AGAIN;
4000
1.47k
        }
4001
493k
        else if (mxIsReference(slot) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND) || (mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND) || (mxStack->kind == XS_SYMBOL_KIND) || (mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))) {
4002
7.02k
          mxSaveState;
4003
7.02k
          fxToPrimitive(the, slot, XS_NO_HINT);
4004
7.02k
          mxRestoreState;
4005
7.02k
          goto XS_CODE_EQUAL_AGAIN;
4006
7.02k
        }
4007
486k
        else if (((XS_BIGINT_KIND == slot->kind) || (XS_BIGINT_X_KIND == slot->kind)) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND) || (mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND))) {
4008
694
          mxSaveState;
4009
694
          offset = gxTypeBigInt.compare(the, 0, 1, 0, slot, mxStack);
4010
694
          mxRestoreState;
4011
694
        }
4012
485k
        else if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND) || (slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_BIGINT_KIND == mxStack->kind) || (XS_BIGINT_X_KIND == mxStack->kind))) {
4013
1.31k
          mxSaveState;
4014
1.31k
          offset = gxTypeBigInt.compare(the, 0, 1, 0, mxStack, slot);
4015
1.31k
          mxRestoreState;
4016
1.31k
        }
4017
484k
                else
4018
484k
                    offset = 0;
4019
563k
      }
4020
627k
      else 
4021
627k
        offset = 0;
4022
1.67M
      slot->kind = XS_BOOLEAN_KIND;
4023
1.67M
      slot->value.boolean = offset;
4024
1.67M
      mxStack++;
4025
1.67M
      mxNextCode(1);
4026
1.67M
      mxBreak;
4027
3.33M
    mxCase(XS_CODE_NOT_EQUAL)
4028
4.38M
    mxCase(XS_CODE_STRICT_NOT_EQUAL)
4029
4.38M
      slot = mxStack + 1;
4030
4.94M
    XS_CODE_NOT_EQUAL_AGAIN:
4031
4.94M
      if (slot->kind == mxStack->kind) {
4032
1.35M
        if ((XS_UNDEFINED_KIND == slot->kind) || (XS_NULL_KIND == slot->kind))
4033
97.0k
          offset = 0;
4034
1.26M
        else if (XS_BOOLEAN_KIND == slot->kind)
4035
404k
          offset = slot->value.boolean != stack->value.boolean;
4036
856k
        else if (XS_INTEGER_KIND == slot->kind)
4037
454k
          offset = slot->value.integer != stack->value.integer;
4038
402k
        else if (XS_NUMBER_KIND == slot->kind) {
4039
58.9k
          offset = (c_isnan(slot->value.number)) || (c_isnan(mxStack->value.number)) || (slot->value.number != mxStack->value.number);
4040
58.9k
          mxFloatingPointOp("not equal");
4041
58.9k
        }
4042
343k
        else if ((XS_STRING_KIND == slot->kind) || (XS_STRING_X_KIND == slot->kind))
4043
338k
          offset = c_strcmp(slot->value.string, mxStack->value.string) != 0;
4044
4.92k
        else if (XS_SYMBOL_KIND == slot->kind)
4045
1.89k
          offset = slot->value.symbol != mxStack->value.symbol;
4046
3.03k
        else if (XS_REFERENCE_KIND == slot->kind)
4047
3.01k
          offset = !fxIsSameReference(the, slot, mxStack);
4048
      #if mxHostFunctionPrimitive
4049
        else if (XS_HOST_FUNCTION_KIND == slot->kind)
4050
          offset = slot->value.hostFunction.builder != mxStack->value.hostFunction.builder;
4051
      #endif
4052
19
        else if ((XS_BIGINT_KIND == slot->kind) || (XS_BIGINT_X_KIND == slot->kind))
4053
19
          offset = gxTypeBigInt.compare(the, 1, 0, 1, slot, mxStack);
4054
0
                else
4055
0
                  offset = 1;
4056
1.35M
      }
4057
3.58M
      else if ((XS_INTEGER_KIND == slot->kind) && (XS_NUMBER_KIND == mxStack->kind)) {
4058
392k
        offset = (c_isnan(mxStack->value.number)) || ((txNumber)(slot->value.integer) != stack->value.number);
4059
392k
        mxFloatingPointOp("not equal");
4060
392k
      }
4061
3.19M
      else if ((XS_NUMBER_KIND == slot->kind) && (XS_INTEGER_KIND == mxStack->kind)) {
4062
357k
        offset = (c_isnan(slot->value.number)) || (slot->value.number != (txNumber)(mxStack->value.integer));
4063
357k
        mxFloatingPointOp("not equal");
4064
357k
      }
4065
2.83M
      else if ((XS_STRING_KIND == slot->kind) && (XS_STRING_X_KIND == mxStack->kind))
4066
0
        offset = c_strcmp(slot->value.string, mxStack->value.string) != 0;
4067
2.83M
      else if ((XS_STRING_X_KIND == slot->kind) && (XS_STRING_KIND == mxStack->kind))
4068
0
        offset = c_strcmp(slot->value.string, mxStack->value.string) != 0;
4069
2.83M
      else if (XS_CODE_NOT_EQUAL == byte) {
4070
2.70M
        if ((slot->kind == XS_UNDEFINED_KIND) && (mxStack->kind == XS_NULL_KIND))
4071
116k
          offset = 0;
4072
2.58M
        else if ((slot->kind == XS_NULL_KIND) && (mxStack->kind == XS_UNDEFINED_KIND))
4073
1.74k
          offset = 0;
4074
2.58M
        else if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_INTEGER_KIND == mxStack->kind) || (XS_NUMBER_KIND == mxStack->kind))) {
4075
5.34k
          mxToNumber(slot);
4076
5.34k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4077
5.34k
        }
4078
2.58M
        else if (((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)) && ((XS_INTEGER_KIND == slot->kind) || (XS_NUMBER_KIND == slot->kind))) {
4079
94.2k
          mxToNumber(mxStack); 
4080
94.2k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4081
94.2k
        }
4082
2.48M
        else if (XS_BOOLEAN_KIND == slot->kind) {
4083
115k
          mxToNumber(slot);
4084
115k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4085
115k
        }
4086
2.37M
        else if (XS_BOOLEAN_KIND == mxStack->kind) {
4087
124k
          mxToNumber(mxStack);
4088
124k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4089
124k
        }
4090
2.24M
        else if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND) || (slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND) || (slot->kind == XS_SYMBOL_KIND) || (slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND)) && mxIsReference(mxStack)) {
4091
94.9k
          mxSaveState;
4092
94.9k
          fxToPrimitive(the, mxStack, XS_NO_HINT);
4093
94.9k
          mxRestoreState;
4094
94.9k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4095
94.9k
        }
4096
2.15M
        else if (mxIsReference(slot) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND) || (mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND) || (mxStack->kind == XS_SYMBOL_KIND) || (mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))) {
4097
123k
          mxSaveState;
4098
123k
          fxToPrimitive(the, slot, XS_NO_HINT);
4099
123k
          mxRestoreState;
4100
123k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4101
123k
        }
4102
2.02M
        else if (((XS_BIGINT_KIND == slot->kind) || (XS_BIGINT_X_KIND == slot->kind)) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND) || (mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND))) {
4103
1.28M
          mxSaveState;
4104
1.28M
          offset = gxTypeBigInt.compare(the, 1, 0, 1, slot, mxStack);
4105
1.28M
          mxRestoreState;
4106
1.28M
        }
4107
742k
        else if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND) || (slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_BIGINT_KIND == mxStack->kind) || (XS_BIGINT_X_KIND == mxStack->kind))) {
4108
441
          mxSaveState;
4109
441
          offset = gxTypeBigInt.compare(the, 1, 0, 1, mxStack, slot);
4110
441
          mxRestoreState;
4111
441
        }
4112
742k
                else
4113
742k
                offset = 1;
4114
2.70M
      }
4115
128k
      else 
4116
128k
        offset = 1;
4117
4.38M
      slot->kind = XS_BOOLEAN_KIND;
4118
4.38M
      slot->value.boolean = offset;
4119
4.38M
      mxStack++;
4120
4.38M
      mxNextCode(1);
4121
4.38M
      mxBreak;
4122
      
4123
4.38M
    mxCase(XS_CODE_FOR_AWAIT_OF)
4124
14
      mxNextCode(1);
4125
14
      mxSaveState;
4126
14
      gxDefaults.runForAwaitOf(the);
4127
14
      mxRestoreState;
4128
14
      mxBreak;
4129
726k
    mxCase(XS_CODE_FOR_IN)
4130
726k
      mxSkipCode(1);
4131
      /* FUNCTION */
4132
726k
      mxAllocStack(1);
4133
726k
      *mxStack = mxEnumeratorFunction;
4134
726k
      slot = fxGetInstance(the, mxStack);
4135
      /* RESULT */
4136
726k
      mxPushKind(XS_UNDEFINED_KIND);
4137
726k
      mxPushKind(XS_UNDEFINED_KIND);
4138
726k
      offset = 0;
4139
726k
      goto XS_CODE_RUN_ALL;
4140
4141
69.4k
    mxCase(XS_CODE_FOR_OF)
4142
69.4k
      mxNextCode(1);
4143
69.4k
      mxSaveState;
4144
69.4k
      fxRunForOf(the);
4145
69.4k
      mxRestoreState;
4146
69.4k
      mxBreak;
4147
      
4148
69.4k
    mxCase(XS_CODE_IN)
4149
42.3k
      mxNextCode(1);
4150
42.3k
      if (!mxIsReference(mxStack))
4151
42.3k
        mxRunDebug(XS_TYPE_ERROR, "in: not an object");
4152
42.3k
      mxSaveState;
4153
42.3k
      fxRunIn(the);
4154
42.3k
      mxRestoreState;
4155
42.3k
      mxBreak;
4156
356k
    mxCase(XS_CODE_INSTANCEOF)
4157
356k
      mxNextCode(1);
4158
356k
      mxSaveState;
4159
356k
      fxRunInstanceOf(the);
4160
356k
      mxRestoreState;
4161
356k
      mxBreak;
4162
952k
    mxCase(XS_CODE_TYPEOF)
4163
952k
      byte = mxStack->kind;
4164
952k
      if (XS_UNDEFINED_KIND == byte)
4165
376k
        *mxStack = mxUndefinedString;
4166
576k
      else if (XS_NULL_KIND == byte)
4167
27
        *mxStack = mxObjectString;
4168
576k
      else if (XS_BOOLEAN_KIND == byte)
4169
481k
        *mxStack = mxBooleanString;
4170
95.5k
      else if ((XS_INTEGER_KIND == byte) || (XS_NUMBER_KIND == byte))
4171
49.3k
        *mxStack = mxNumberString;
4172
46.2k
      else if ((XS_STRING_KIND == byte) || (XS_STRING_X_KIND == byte))
4173
415
        *mxStack = mxStringString;
4174
45.8k
      else if (XS_SYMBOL_KIND == byte)
4175
20
        *mxStack = mxSymbolString;
4176
45.7k
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte))
4177
902
        *mxStack = mxBigIntString;
4178
44.8k
      else if (XS_REFERENCE_KIND == byte) {
4179
44.8k
        slot = fxGetInstance(the, mxStack);
4180
44.8k
        if (slot->flag & XS_CAN_CALL_FLAG)
4181
2.99k
          *mxStack = mxFunctionString;
4182
41.8k
        else
4183
41.8k
          *mxStack = mxObjectString;
4184
44.8k
      }
4185
    #if mxHostFunctionPrimitive
4186
      else if (XS_HOST_FUNCTION_KIND == byte)
4187
        *mxStack = mxFunctionString;
4188
    #endif
4189
952k
      mxNextCode(1);
4190
952k
      mxBreak;
4191
952k
    mxCase(XS_CODE_VOID)
4192
38.2k
      mxNextCode(1);
4193
38.2k
      mxStack->kind = XS_UNDEFINED_KIND;
4194
38.2k
      mxBreak;
4195
4196
  /* DEBUG */    
4197
38.2k
    mxCase(XS_CODE_DEBUGGER)
4198
5.82k
      mxNextCode(1);
4199
5.82k
    #ifdef mxDebug
4200
5.82k
      if (!the->debugEval) {
4201
5.82k
        mxSaveState;
4202
5.82k
        fxDebugLoop(the, C_NULL, 0, "debugger");
4203
5.82k
        mxRestoreState;
4204
5.82k
      }
4205
5.82k
    #endif
4206
5.82k
      mxBreak;
4207
8.85M
    mxCase(XS_CODE_FILE)
4208
8.85M
    #ifdef mxDebug
4209
8.85M
      count = mxRunID(1);
4210
#ifdef mxTrace
4211
      if (gxDoTrace) fxTraceID(the, count, 0);
4212
#endif
4213
8.85M
      mxEnvironment->ID = count;
4214
8.85M
      mxEnvironment->value.environment.line = 0;
4215
8.85M
    #endif
4216
8.85M
      mxNextCode(1 + sizeof(txID));
4217
8.85M
      mxBreak;
4218
101M
    mxCase(XS_CODE_LINE)
4219
101M
    #ifdef mxDebug
4220
101M
      count = mxRunS2(1);
4221
#ifdef mxTrace
4222
      if (gxDoTrace) fxTraceInteger(the, count);
4223
#endif
4224
101M
      if (count == 0) {
4225
9.37M
        count = mxFunctionInstanceCode(mxFrameFunction->value.reference)->ID;
4226
9.37M
        if ((mxEnvironment->ID != XS_NO_ID) && (count != XS_NO_ID) && mxBreakpoints.value.list.first) {
4227
0
          mxSaveState;
4228
0
          fxDebugLine(the, mxEnvironment->ID, mxEnvironment->value.environment.line, count);
4229
0
          mxRestoreState;
4230
0
        }
4231
9.37M
      }
4232
92.2M
      else {
4233
92.2M
        mxEnvironment->value.environment.line = count;
4234
92.2M
        if (fxIsReadable(the)) {
4235
0
          mxSaveState;
4236
0
          fxDebugCommand(the);
4237
0
          mxRestoreState;
4238
0
        }
4239
92.2M
        if ((mxEnvironment->ID != XS_NO_ID) && ((mxFrame->flag & XS_STEP_OVER_FLAG) || mxBreakpoints.value.list.first)) {
4240
0
          mxSaveState;
4241
0
          fxDebugLine(the, mxEnvironment->ID, mxEnvironment->value.environment.line, XS_NO_ID);
4242
0
          mxRestoreState;
4243
0
        }
4244
92.2M
      }
4245
101M
    #endif
4246
101M
    #if defined(mxInstrument) || defined(mxProfile)
4247
101M
      fxCheckProfiler(the, mxFrame);
4248
101M
    #endif
4249
101M
      mxNextCode(3);
4250
101M
      mxBreak;
4251
4252
  /* MODULE */    
4253
101M
    mxCase(XS_CODE_IMPORT)
4254
15.8k
      slot = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4255
15.8k
      variable = mxModuleInstanceInternal(slot);
4256
15.8k
      variable = variable->value.module.realm;
4257
15.8k
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4258
15.8k
      mxSaveState;
4259
15.8k
      gxDefaults.runImport(the, variable, slot);
4260
15.8k
      mxRestoreState;
4261
15.8k
      mxNextCode(1);
4262
15.8k
      mxBreak;
4263
15.8k
    mxCase(XS_CODE_IMPORT_META)
4264
54
      slot = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4265
54
      mxSaveState;
4266
54
      fxRunImportMeta(the, slot);
4267
54
      mxRestoreState;
4268
54
      mxNextCode(1);
4269
54
      mxBreak;
4270
2.05k
    mxCase(XS_CODE_TRANSFER)
4271
2.05k
      mxSaveState;
4272
2.05k
      fxPrepareTransfer(the, XS_NO_FLAG);
4273
2.05k
      mxRestoreState;
4274
2.05k
            mxNextCode(1);
4275
2.05k
      mxBreak;
4276
2.05k
    mxCase(XS_CODE_TRANSFER_JSON)
4277
0
      mxSaveState;
4278
0
      fxPrepareTransfer(the, XS_JSON_MODULE_FLAG);
4279
0
      mxRestoreState;
4280
0
            mxNextCode(1);
4281
0
      mxBreak;
4282
2.94k
    mxCase(XS_CODE_MODULE)
4283
2.94k
      byte = mxRunU1(1);
4284
2.94k
      mxSaveState;
4285
2.94k
      fxPrepareModule(the, byte);
4286
2.94k
      mxRestoreState;
4287
2.94k
            mxNextCode(2);
4288
2.94k
      mxBreak;
4289
      
4290
  /* EVAL, PROGRAM & WITH */
4291
397k
    mxCase(XS_CODE_EVAL)
4292
397k
      offset = mxStack->value.integer;
4293
397k
      slot = mxStack + 1 + offset + 2;
4294
397k
      if (mxIsReference(slot) && mxIsFunction(slot->value.reference) && (mxFunctionInstanceCode(slot->value.reference)->value.callback.address == mxFunctionInstanceCode(mxEvalFunction.value.reference)->value.callback.address)) {
4295
396k
        mxSaveState;
4296
396k
        gxDefaults.runEval(the);
4297
396k
        mxRestoreState;
4298
396k
        mxNextCode(1);
4299
396k
        mxBreak;
4300
396k
      }
4301
397k
      mxSkipCode(1);
4302
397k
      mxStack++;
4303
397k
      goto XS_CODE_RUN_ALL;
4304
4
    mxCase(XS_CODE_EVAL_TAIL)
4305
4
      offset = mxStack->value.integer;
4306
4
      slot = mxStack + 1 + offset + 2;
4307
4
      if (mxIsReference(slot) && mxIsFunction(slot->value.reference) && (mxFunctionInstanceCode(slot->value.reference)->value.callback.address == mxFunctionInstanceCode(mxEvalFunction.value.reference)->value.callback.address)) {
4308
4
        mxSaveState;
4309
4
        gxDefaults.runEval(the);
4310
4
        mxRestoreState;
4311
4
        mxNextCode(1);
4312
4
        mxBreak;
4313
4
      }
4314
4
      mxSkipCode(1);
4315
4
      mxStack++;
4316
4
      goto XS_CODE_RUN_TAIL_ALL;
4317
104k
    mxCase(XS_CODE_EVAL_ENVIRONMENT)
4318
104k
      mxNextCode(1);
4319
104k
      mxSaveState;
4320
104k
      gxDefaults.runEvalEnvironment(the);
4321
104k
      mxRestoreState;
4322
104k
      mxBreak;
4323
104k
    mxCase(XS_CODE_EVAL_PRIVATE)
4324
391
      offset = mxRunID(1);
4325
    #ifdef mxTrace
4326
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4327
    #endif
4328
391
      mxNextCode(1 + sizeof(txID));
4329
391
      variable = mxEnvironment;
4330
391
      if (variable->kind == XS_REFERENCE_KIND) {
4331
391
        variable = variable->value.reference;
4332
3.91k
    XS_CODE_EVAL_PRIVATE_AGAIN:
4333
3.91k
        if (variable) {
4334
3.51k
          slot = mxBehaviorGetProperty(the, variable, (txID)offset, 0, XS_OWN);
4335
3.51k
          if (slot) {
4336
0
            mxPushKind(slot->kind);
4337
0
            mxStack->value = slot->value;
4338
0
            mxBreak;
4339
0
          }
4340
3.51k
          variable = variable->value.instance.prototype;
4341
3.51k
          goto XS_CODE_EVAL_PRIVATE_AGAIN;
4342
3.51k
        }
4343
3.91k
      }
4344
391
      mxRunDebugID(XS_SYNTAX_ERROR, "eval %s: undefined private property", (txID)offset);
4345
0
      mxBreak;
4346
6.66M
    mxCase(XS_CODE_EVAL_REFERENCE)
4347
6.66M
      offset = mxRunID(1);
4348
    #ifdef mxTrace
4349
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4350
    #endif
4351
6.66M
      mxNextCode(1 + sizeof(txID));
4352
6.66M
      variable = mxEnvironment;
4353
6.66M
      if (variable->kind == XS_REFERENCE_KIND) {
4354
6.66M
        variable = variable->value.reference;
4355
17.9M
    XS_CODE_EVAL_REFERENCE_AGAIN:
4356
17.9M
        if (variable->value.instance.prototype) {
4357
11.9M
          slot = variable->next;
4358
11.9M
          if (slot->kind == XS_REFERENCE_KIND) {
4359
5.76M
            slot = slot->value.reference;
4360
5.76M
            mxSaveState;
4361
5.76M
            index = fxIsScopableSlot(the, slot, (txID)offset);
4362
5.76M
            mxRestoreState;
4363
5.76M
            if (index) {
4364
//              if (fxRunHas(the, slot, (txID)offset, 0)) {
4365
240k
                if (XS_CODE_GET_THIS_VARIABLE == byte) {
4366
47.6k
                  mxStack->kind = XS_REFERENCE_KIND;
4367
47.6k
                  mxStack->value.reference = slot;
4368
47.6k
                }
4369
240k
                mxPushKind(XS_REFERENCE_KIND);
4370
240k
                mxStack->value.reference = slot;
4371
240k
                mxBreak;
4372
//              }
4373
240k
            }
4374
5.76M
          }
4375
6.16M
          else if (mxBehaviorHasProperty(the, variable, (txID)offset, 0)) {
4376
372k
            mxPushKind(XS_REFERENCE_KIND);
4377
372k
            mxStack->value.reference = variable;
4378
372k
            mxBreak;
4379
372k
          }
4380
11.9M
          variable = variable->value.instance.prototype;
4381
11.9M
          goto XS_CODE_EVAL_REFERENCE_AGAIN;
4382
11.9M
        }
4383
6.04M
        if (mxBehaviorHasProperty(the, variable, (txID)offset, 0)) {
4384
3.59k
          mxPushKind(XS_REFERENCE_KIND);
4385
3.59k
          mxStack->value.reference = variable;
4386
3.59k
          mxBreak;
4387
3.59k
        }
4388
6.04M
      }
4389
12.0M
      mxPushKind(XS_REFERENCE_KIND);
4390
12.0M
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4391
12.0M
      variable = mxModuleInstanceInternal(variable)->value.module.realm;
4392
12.0M
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4393
12.0M
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
4394
12.0M
      mxBreak;
4395
12.0M
    mxCase(XS_CODE_FUNCTION_ENVIRONMENT)  
4396
382k
      variable = mxEnvironment;
4397
382k
      mxPushKind(XS_UNDEFINED_KIND);
4398
382k
      mxSaveState;
4399
382k
      slot = fxNewEnvironmentInstance(the, variable);
4400
382k
      mxRestoreState;
4401
382k
      variable = mxFunctionInstanceCode((mxStack + 1)->value.reference);
4402
382k
      variable->value.code.closures = slot;
4403
382k
      mxNextCode(1);
4404
382k
      mxBreak;
4405
382k
    mxCase(XS_CODE_PROGRAM_ENVIRONMENT)
4406
13.9k
      mxNextCode(1);
4407
13.9k
      mxSaveState;
4408
13.9k
      gxDefaults.runProgramEnvironment(the);
4409
13.9k
      mxRestoreState;
4410
13.9k
      mxBreak;
4411
134M
    mxCase(XS_CODE_PROGRAM_REFERENCE)
4412
134M
      offset = mxRunID(1);
4413
    #ifdef mxTrace
4414
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4415
    #endif
4416
134M
      mxNextCode(1 + sizeof(txID));
4417
134M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4418
134M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
4419
134M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4420
134M
            slot = mxRealmClosures(variable)->value.reference;
4421
134M
            if (mxBehaviorHasProperty(the, slot, (txID)offset, 0)) {
4422
39
                mxPushKind(XS_REFERENCE_KIND);
4423
39
                mxStack->value.reference = slot;
4424
39
                mxBreak;
4425
39
            }
4426
268M
      mxPushKind(XS_REFERENCE_KIND);
4427
268M
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
4428
268M
      mxBreak;
4429
268M
    mxCase(XS_CODE_WITH)
4430
1.73M
      variable = mxEnvironment;
4431
1.73M
      mxSaveState;
4432
1.73M
      slot = fxNewEnvironmentInstance(the, variable);
4433
1.73M
      mxRestoreState;
4434
1.73M
      variable->kind = XS_REFERENCE_KIND;
4435
1.73M
      variable->value.reference = slot;
4436
1.73M
      mxNextCode(1);
4437
1.73M
      mxBreak;
4438
1.73M
    mxCase(XS_CODE_WITHOUT)
4439
73.0k
      variable = mxEnvironment;
4440
73.0k
      slot = variable->value.reference->value.instance.prototype;
4441
73.0k
      if (slot) {
4442
73.0k
        variable->kind = XS_REFERENCE_KIND;
4443
73.0k
        variable->value.reference = slot;
4444
73.0k
      }
4445
0
      else
4446
0
        variable->kind = XS_NULL_KIND;
4447
73.0k
      mxNextCode(1);
4448
73.0k
      mxBreak;
4449
73.0k
    }
4450
73.0k
  }
4451
4452
73.0k
STACK_OVERFLOW:
4453
48
  mxSaveState;
4454
48
  fxAbort(the, XS_JAVASCRIPT_STACK_OVERFLOW_EXIT);
4455
48
}
4456
4457
#ifdef mxMetering
4458
4459
void fxBeginMetering(txMachine* the, txBoolean (*callback)(txMachine*, txU8), txU8 interval)
4460
32.1k
{
4461
32.1k
  the->meterCallback = callback;
4462
32.1k
  the->meterCount = ((txU8)interval) << 16;
4463
32.1k
  the->meterIndex = 0;
4464
32.1k
  the->meterInterval = ((txU8)interval) << 16;
4465
32.1k
}
4466
4467
void fxEndMetering(txMachine* the)
4468
31.1k
{
4469
31.1k
  the->meterCallback = C_NULL;
4470
31.1k
  the->meterIndex = 0;
4471
31.1k
  the->meterInterval = 0;
4472
31.1k
  the->meterCount = 0;
4473
31.1k
}
4474
4475
void fxCheckMetering(txMachine* the)
4476
36.6k
{
4477
36.6k
  txU8 interval = the->meterInterval;
4478
36.6k
  the->meterInterval = 0;
4479
36.6k
  if ((*the->meterCallback)(the, the->meterIndex >> 16)) {
4480
35.8k
    the->meterCount = the->meterIndex + interval;
4481
35.8k
    if (the->meterCount < the->meterIndex) {
4482
0
      the->meterIndex = 0;
4483
0
      the->meterCount = interval;
4484
0
    }
4485
35.8k
    the->meterInterval = interval;
4486
35.8k
  }
4487
817
  else {
4488
817
    fxAbort(the, XS_TOO_MUCH_COMPUTATION_EXIT);
4489
817
  }
4490
36.6k
}
4491
#endif
4492
4493
void fxRunArguments(txMachine* the, txIndex offset)
4494
97.5k
{
4495
97.5k
  txSlot* array;
4496
97.5k
  txIndex length = (txIndex)mxArgc;
4497
97.5k
  txIndex index;
4498
97.5k
  txSlot* address;
4499
97.5k
  mxPush(mxArrayPrototype);
4500
97.5k
  array = fxNewArrayInstance(the)->next;
4501
97.5k
  if (offset < length) {
4502
1.52k
    length -= offset;
4503
1.52k
    fxSetIndexSize(the, array, length, XS_CHUNK);
4504
1.52k
    index = 0;
4505
1.52k
    address = array->value.array.address;
4506
7.48k
    while (index < length) {
4507
5.96k
      txSlot* property = mxArgv(offset + index);
4508
5.96k
      *((txIndex*)address) = index;
4509
5.96k
      address->ID = XS_NO_ID;
4510
5.96k
      address->kind = property->kind;
4511
5.96k
      address->value = property->value;
4512
5.96k
      index++;
4513
5.96k
      address++;
4514
5.96k
    }
4515
1.52k
  }
4516
97.5k
}
4517
4518
void fxRunBase(txMachine* the)
4519
22.0k
{
4520
22.0k
  if (!mxHasTarget)
4521
115
    mxTypeError("call: class");
4522
21.9k
  fxRunConstructor(the);
4523
21.9k
}
4524
4525
void fxRunConstructor(txMachine* the)
4526
165k
{
4527
165k
  txSlot* target;
4528
165k
  txSlot* prototype;
4529
165k
  target = mxTarget;
4530
165k
  mxPushUndefined();
4531
165k
  prototype = the->stack;
4532
165k
  fxBeginHost(the);
4533
165k
  mxPushSlot(target);
4534
165k
  fxGetPrototypeFromConstructor(the, &mxObjectPrototype);
4535
165k
  *prototype = *the->stack;
4536
165k
  fxEndHost(the);
4537
165k
  fxNewHostInstance(the);
4538
165k
  mxPullSlot(mxThis);
4539
165k
}
4540
4541
txBoolean fxRunDefine(txMachine* the, txSlot* instance, txSlot* check, txID id, txIndex index, txSlot* slot, txFlag mask) 
4542
17.3M
{
4543
17.3M
  txBoolean result;
4544
17.3M
  if (check) {
4545
21.8k
    result = gxDefaults.definePrivateProperty(the, instance, check, id, slot, mask);
4546
21.8k
  }
4547
17.3M
  else {
4548
17.3M
    fxBeginHost(the);
4549
17.3M
    mxCheck(the, instance->kind == XS_INSTANCE_KIND);
4550
17.3M
    result = mxBehaviorDefineOwnProperty(the, instance, id, index, slot, mask);
4551
17.3M
    fxEndHost(the);
4552
17.3M
  }
4553
17.3M
  return result;
4554
17.3M
}
4555
4556
4557
txBoolean fxRunDelete(txMachine* the, txSlot* instance, txID id, txIndex index) 
4558
708k
{
4559
708k
  txBoolean result;
4560
708k
  fxBeginHost(the);
4561
708k
  mxCheck(the, instance->kind == XS_INSTANCE_KIND);
4562
708k
  result = mxBehaviorDeleteProperty(the, instance, id, index);
4563
708k
  fxEndHost(the);
4564
708k
  return result;
4565
708k
}
4566
4567
void fxRunDerived(txMachine* the)
4568
222
{
4569
222
  txSlot* slot;
4570
222
  if (!mxHasTarget)
4571
1
    mxTypeError("call: class");
4572
221
  slot = fxNewSlot(the);
4573
221
  slot->kind = XS_UNINITIALIZED_KIND;
4574
221
  mxPushClosure(slot);
4575
221
  mxPullSlot(mxThis);
4576
221
}
4577
4578
void fxRunExtends(txMachine* the)
4579
57.2k
{
4580
57.2k
  txSlot* constructor;
4581
57.2k
  txSlot* prototype;
4582
  
4583
57.2k
  constructor = fxGetInstance(the, the->stack);
4584
57.2k
  if (!mxIsConstructor(constructor))
4585
3
    mxTypeError("extends: class is not a constructor");
4586
57.2k
  mxPushUndefined();
4587
57.2k
  prototype = the->stack;
4588
57.2k
  fxBeginHost(the);
4589
57.2k
  mxPushReference(constructor);
4590
57.2k
  mxGetID(mxID(_prototype));
4591
57.2k
  *prototype = *the->stack;
4592
57.2k
  fxEndHost(the);
4593
57.2k
  if (the->stack->kind == XS_NULL_KIND) {
4594
0
    mxPop();
4595
0
    fxNewInstance(the);
4596
0
  }
4597
57.2k
  else if (the->stack->kind == XS_REFERENCE_KIND) {
4598
57.2k
    if (the->stack->value.reference->value.instance.prototype == mxGeneratorPrototype.value.reference)
4599
0
      mxTypeError("extends: class is a generator");
4600
57.2k
    fxNewHostInstance(the);
4601
57.2k
  }
4602
0
  else
4603
0
    mxTypeError("extends: class prototype is not an object");
4604
57.2k
}
4605
4606
void fxRunEval(txMachine* the)
4607
396k
{ 
4608
396k
  txStringStream aStream;
4609
396k
  txUnsigned flags;
4610
396k
  txSlot* function;
4611
396k
  txSlot* home;
4612
396k
  txSlot* closures;
4613
396k
  if (the->stack->value.integer == 0)
4614
287
    the->stack->kind = XS_UNDEFINED_KIND;
4615
396k
  else
4616
396k
    the->stack += the->stack->value.integer;
4617
396k
  the->stack[4] = the->stack[0];
4618
396k
  the->stack += 4;
4619
396k
  if ((the->stack->kind == XS_STRING_KIND) || (the->stack->kind == XS_STRING_X_KIND)) {
4620
391k
    aStream.slot = the->stack;
4621
391k
    aStream.offset = 0;
4622
391k
    aStream.size = mxStringLength(fxToString(the, aStream.slot));
4623
391k
    flags = mxProgramFlag | mxEvalFlag;
4624
391k
    if (the->frame->flag & XS_STRICT_FLAG)
4625
9
      flags |= mxStrictFlag;
4626
391k
    if (the->frame->flag & XS_FIELD_FLAG)
4627
0
      flags |= mxFieldFlag;
4628
391k
    function = mxFunction->value.reference;
4629
391k
    if (function->flag & XS_CAN_CONSTRUCT_FLAG)
4630
2.96k
      flags |= mxTargetFlag;
4631
391k
    home = mxFunctionInstanceHome(function);
4632
391k
    if (home->value.home.object)
4633
0
      flags |= mxSuperFlag;
4634
391k
    closures = mxFrameToEnvironment(the->frame);
4635
391k
    if (closures->kind == XS_REFERENCE_KIND)
4636
391k
      closures = closures->value.reference;
4637
0
    else
4638
0
      closures = C_NULL;
4639
391k
    fxRunScript(the, fxParseScript(the, &aStream, fxStringGetter, flags), mxThis, mxHasTarget ? mxTarget : C_NULL, closures, home->value.home.object, home->value.home.module);
4640
391k
    aStream.slot->kind = the->stack->kind;
4641
391k
    aStream.slot->value = the->stack->value;
4642
391k
    mxPop();
4643
391k
  }
4644
396k
}
4645
4646
void fxRunForAwaitOf(txMachine* the)
4647
14
{
4648
14
  txSlot* slot = the->stack;
4649
14
  fxBeginHost(the);
4650
14
  mxPushSlot(slot);
4651
14
  mxDub();
4652
14
  mxGetID(mxID(_Symbol_asyncIterator));
4653
14
  if (mxIsUndefined(the->stack) || mxIsNull(the->stack)) {
4654
8
    mxPop();
4655
8
    mxPop();
4656
8
    fxGetIterator(the, slot, the->stack, C_NULL, 0);
4657
8
    fxNewAsyncFromSyncIteratorInstance(the);
4658
8
  }
4659
6
  else {
4660
6
    mxCall();
4661
6
    mxRunCount(0);
4662
6
  }
4663
14
  mxPullSlot(slot);
4664
14
  fxEndHost(the);
4665
14
}
4666
4667
void fxRunForOf(txMachine* the)
4668
69.4k
{
4669
69.4k
  txSlot* slot = the->stack;
4670
69.4k
  fxBeginHost(the);
4671
69.4k
  fxGetIterator(the, slot, slot, C_NULL, 0);
4672
69.4k
  fxEndHost(the);
4673
69.4k
}
4674
4675
txBoolean fxRunHas(txMachine* the, txSlot* instance, txID id, txIndex index)
4676
46.8M
{
4677
46.8M
  txBoolean result;
4678
46.8M
  fxBeginHost(the);
4679
46.8M
  result = mxBehaviorHasProperty(the, instance, id, index);
4680
46.8M
  fxEndHost(the);
4681
46.8M
  return result;
4682
46.8M
}
4683
4684
void fxRunIn(txMachine* the)
4685
42.3k
{
4686
42.3k
  txSlot* left = the->stack + 1;
4687
42.3k
  txSlot* right = the->stack;
4688
42.3k
  fxBeginHost(the);
4689
42.3k
  mxPushSlot(right);
4690
42.3k
  mxPushSlot(left);
4691
42.3k
  left->value.boolean = fxHasAt(the);
4692
42.3k
  left->kind = XS_BOOLEAN_KIND;
4693
42.3k
  fxEndHost(the);
4694
42.3k
  mxPop();
4695
42.3k
}
4696
4697
void fxRunInstanceOf(txMachine* the)
4698
356k
{
4699
356k
  txSlot* left = the->stack + 1;
4700
356k
  txSlot* right = the->stack;
4701
356k
  fxBeginHost(the);
4702
356k
  mxPushSlot(right);
4703
356k
  mxDub();
4704
356k
  mxGetID(mxID(_Symbol_hasInstance));
4705
356k
  mxCall();
4706
356k
  mxPushSlot(left);
4707
356k
  mxRunCount(1);
4708
356k
  fxToBoolean(the, the->stack);
4709
356k
  mxPullSlot(left);
4710
356k
  fxEndHost(the);
4711
356k
  mxPop();
4712
356k
}
4713
4714
void fxRunInstantiate(txMachine* the)
4715
125
{
4716
125
  if (the->stack->kind == XS_NULL_KIND) {
4717
88
    mxPop();
4718
88
    fxNewInstance(the);
4719
88
  }
4720
37
  else if (the->stack->kind == XS_REFERENCE_KIND) {
4721
34
    fxNewHostInstance(the);
4722
34
  }
4723
3
  else {
4724
3
    mxPop();
4725
3
    mxPush(mxObjectPrototype);
4726
3
    fxNewObjectInstance(the);
4727
3
  }
4728
125
}
4729
4730
void fxRunProxy(txMachine* the, txSlot* instance)
4731
110k
{
4732
110k
  txSlot* array;
4733
110k
  txIndex length = (txIndex)mxArgc;
4734
110k
  txIndex index;
4735
110k
  txSlot* address;
4736
110k
  mxPush(mxArrayPrototype);
4737
110k
  array = fxNewArrayInstance(the)->next;
4738
110k
  fxSetIndexSize(the, array, length, XS_CHUNK);
4739
110k
  index = 0;
4740
110k
  address = array->value.array.address;
4741
110k
  while (index < length) {
4742
39
    txSlot* property = mxArgv(index);
4743
39
    *((txIndex*)address) = index;
4744
39
    address->ID = XS_NO_ID;
4745
39
    address->kind = property->kind;
4746
39
    address->value = property->value;
4747
39
    index++;
4748
39
    address++;
4749
39
  }
4750
110k
  if (!mxHasTarget)
4751
110k
    mxBehaviorCall(the, instance, mxThis, the->stack);
4752
7
  else if (instance->flag & XS_CAN_CONSTRUCT_FLAG)
4753
6
    mxBehaviorConstruct(the, instance, the->stack, mxTarget);
4754
1
  else
4755
1
    mxTypeError("new: proxy is not a constructor");
4756
110k
  mxPop();
4757
110k
}
4758
4759
txBoolean fxIsSameReference(txMachine* the, txSlot* a, txSlot* b)
4760
200k
{ 
4761
200k
  a = a->value.reference;
4762
200k
  b = b->value.reference;
4763
200k
  if (a == b)
4764
116k
    return 1;
4765
#if mxAliasInstance
4766
  if (a->ID) {
4767
    txSlot* alias = the->aliasArray[a->ID];
4768
    if (alias) {
4769
      a = alias;
4770
      if (a == b)
4771
        return 1;
4772
    }
4773
  }
4774
  if (b->ID) {
4775
    txSlot* alias = the->aliasArray[b->ID];
4776
    if (alias) {
4777
      b = alias;
4778
      if (a == b)
4779
        return 1;
4780
    }
4781
  }
4782
#endif
4783
84.6k
  return 0;
4784
200k
}
4785
4786
txBoolean fxIsSameSlot(txMachine* the, txSlot* a, txSlot* b)
4787
956k
{ 
4788
956k
  txBoolean result = 0;
4789
956k
  if (a->kind == b->kind) {
4790
883k
    if ((XS_UNDEFINED_KIND == a->kind) || (XS_NULL_KIND == a->kind))
4791
1.76k
      result = 1;
4792
881k
    else if (XS_BOOLEAN_KIND == a->kind)
4793
4.41k
      result = a->value.boolean == b->value.boolean;
4794
877k
    else if (XS_INTEGER_KIND == a->kind)
4795
760k
      result = a->value.integer == b->value.integer;
4796
116k
        else if (XS_NUMBER_KIND == a->kind) {
4797
3.28k
      result = (!c_isnan(a->value.number)) && (!c_isnan(b->value.number)) && (a->value.number == b->value.number);
4798
3.28k
      mxFloatingPointOp("same slot");
4799
3.28k
    }
4800
113k
    else if ((XS_STRING_KIND == a->kind) || (XS_STRING_X_KIND == a->kind))
4801
643
      result = c_strcmp(a->value.string, b->value.string) == 0;
4802
112k
    else if (XS_SYMBOL_KIND == a->kind)
4803
0
      result = a->value.symbol == b->value.symbol;
4804
112k
    else if ((XS_BIGINT_KIND == a->kind) || (XS_BIGINT_X_KIND == a->kind))
4805
0
      result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4806
112k
    else if (XS_REFERENCE_KIND == a->kind)
4807
112k
      result = fxIsSameReference(the, a, b);
4808
883k
  }
4809
72.5k
  else if ((XS_INTEGER_KIND == a->kind) && (XS_NUMBER_KIND == b->kind)) {
4810
3.38k
    result = (!c_isnan(b->value.number)) && ((txNumber)(a->value.integer) == b->value.number);
4811
3.38k
    mxFloatingPointOp("same slot");
4812
3.38k
  }
4813
69.1k
  else if ((XS_NUMBER_KIND == a->kind) && (XS_INTEGER_KIND == b->kind)) {
4814
1.53k
    result = (!c_isnan(a->value.number)) && (a->value.number == (txNumber)(b->value.integer));
4815
1.53k
    mxFloatingPointOp("same slot");
4816
1.53k
  }
4817
67.5k
  else if ((XS_STRING_KIND == a->kind) && (XS_STRING_X_KIND == b->kind))
4818
0
    result = c_strcmp(a->value.string, b->value.string) == 0;
4819
67.5k
  else if ((XS_STRING_X_KIND == a->kind) && (XS_STRING_KIND == b->kind))
4820
0
    result = c_strcmp(a->value.string, b->value.string) == 0;
4821
67.5k
  else if ((XS_BIGINT_KIND == a->kind) && (XS_BIGINT_X_KIND == b->kind))
4822
0
    result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4823
67.5k
  else if ((XS_BIGINT_X_KIND == a->kind) && (XS_BIGINT_KIND == b->kind))
4824
0
    result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4825
956k
  return result;
4826
956k
}
4827
4828
txBoolean fxIsSameValue(txMachine* the, txSlot* a, txSlot* b, txBoolean zero)
4829
2.70M
{
4830
2.70M
  txBoolean result = 0;
4831
2.70M
  if (a->kind == b->kind) {
4832
330k
    if ((XS_UNDEFINED_KIND == a->kind) || (XS_NULL_KIND == a->kind))
4833
8.78k
      result = 1;
4834
321k
    else if (XS_BOOLEAN_KIND == a->kind)
4835
397
      result = a->value.boolean == b->value.boolean;
4836
320k
    else if (XS_INTEGER_KIND == a->kind)
4837
176k
      result = a->value.integer == b->value.integer;
4838
144k
        else if (XS_NUMBER_KIND == a->kind) {
4839
107k
      result = ((c_isnan(a->value.number) && c_isnan(b->value.number)) || ((a->value.number == b->value.number) && (zero || (c_signbit(a->value.number) == c_signbit(b->value.number)))));
4840
107k
      mxFloatingPointOp("same value");
4841
107k
    }
4842
36.7k
    else if ((XS_STRING_KIND == a->kind) || (XS_STRING_X_KIND == a->kind))
4843
29.0k
      result = c_strcmp(a->value.string, b->value.string) == 0;
4844
7.67k
    else if (XS_SYMBOL_KIND == a->kind)
4845
7.32k
      result = a->value.symbol == b->value.symbol;
4846
356
    else if ((XS_BIGINT_KIND == a->kind) || (XS_BIGINT_X_KIND == a->kind))
4847
0
      result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4848
356
    else if (XS_REFERENCE_KIND == a->kind)
4849
356
      result = fxIsSameReference(the, a, b);
4850
330k
  }
4851
2.37M
  else if ((XS_INTEGER_KIND == a->kind) && (XS_NUMBER_KIND == b->kind)) {
4852
120k
    txNumber aNumber = a->value.integer;
4853
120k
    result = (aNumber == b->value.number) && (zero || (signbit(aNumber) == signbit(b->value.number)));
4854
120k
    mxFloatingPointOp("same value");
4855
120k
  }
4856
2.25M
  else if ((XS_NUMBER_KIND == a->kind) && (XS_INTEGER_KIND == b->kind)) {
4857
665
    txNumber bNumber = b->value.integer;
4858
665
    result = (a->value.number == bNumber) && (zero || (signbit(a->value.number) == signbit(bNumber)));
4859
665
    mxFloatingPointOp("same value");
4860
665
  }
4861
2.25M
  else if ((XS_STRING_KIND == a->kind) && (XS_STRING_X_KIND == b->kind))
4862
0
    result = c_strcmp(a->value.string, b->value.string) == 0;
4863
2.25M
  else if ((XS_STRING_X_KIND == a->kind) && (XS_STRING_KIND == b->kind))
4864
0
    result = c_strcmp(a->value.string, b->value.string) == 0;
4865
2.25M
  else if ((XS_BIGINT_KIND == a->kind) && (XS_BIGINT_X_KIND == b->kind))
4866
0
    result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4867
2.25M
  else if ((XS_BIGINT_X_KIND == a->kind) && (XS_BIGINT_KIND == b->kind))
4868
0
    result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
4869
2.70M
  return result;
4870
2.70M
}
4871
4872
txBoolean fxIsScopableSlot(txMachine* the, txSlot* instance, txID id)
4873
5.76M
{ 
4874
5.76M
  txBoolean result;
4875
5.76M
  fxBeginHost(the);
4876
5.76M
  mxPushReference(instance);
4877
5.76M
  result = mxHasID(id);
4878
5.76M
  if (result) {
4879
240k
    mxPushReference(instance);
4880
240k
    mxGetID(mxID(_Symbol_unscopables));
4881
240k
    if (mxIsReference(the->stack)) {
4882
2
      mxGetID(id);
4883
2
      result = fxToBoolean(the, the->stack) ? 0 : 1;
4884
2
    }
4885
240k
    mxPop();
4886
240k
  }
4887
5.76M
  fxEndHost(the);
4888
5.76M
  return result;
4889
5.76M
}
4890
4891
void fxRemapIDs(txMachine* the, txByte* codeBuffer, txSize codeSize, txID* theIDs)
4892
551k
{
4893
551k
  register const txS1* bytes = gxCodeSizes;
4894
551k
  register txByte* p = codeBuffer;
4895
551k
  register txByte* q = codeBuffer + codeSize;
4896
551k
  register txS1 offset;
4897
551k
  txID id;
4898
19.8M
  while (p < q) {
4899
    //fprintf(stderr, "%s", gxCodeNames[*((txU1*)p)]);
4900
19.3M
    offset = (txS1)c_read8(bytes + c_read8(p));
4901
19.3M
    if (0 < offset)
4902
15.1M
      p += offset;
4903
4.21M
    else if (0 == offset) {
4904
3.21M
      p++;
4905
3.21M
      mxDecodeID(p, id);
4906
3.21M
      if (id != XS_NO_ID) {
4907
3.16M
        id = theIDs[id];
4908
3.16M
        p -= sizeof(txID);
4909
3.16M
        mxEncodeID(p, id);
4910
3.16M
      }
4911
3.21M
    }
4912
998k
    else if (-1 == offset) {
4913
986k
      txU1 index;
4914
986k
      p++;
4915
986k
      index = *((txU1*)p);
4916
986k
      p += 1 + index;
4917
986k
    }
4918
11.2k
        else if (-2 == offset) {
4919
11.2k
      txU2 index;
4920
11.2k
            p++;
4921
11.2k
            mxDecode2(p, index);
4922
11.2k
            p += index;
4923
11.2k
        }
4924
0
        else if (-4 == offset) {
4925
0
      txS4 index;
4926
0
            p++;
4927
0
            mxDecode4(p, index);
4928
0
            p += index;
4929
0
        }
4930
    //fprintf(stderr, "\n");
4931
19.3M
  }
4932
551k
}
4933
4934
void fxRemapScript(txMachine* the, txScript* script)
4935
551k
{
4936
551k
  mxPushUndefined();
4937
551k
  if (script->symbolsBuffer) {
4938
551k
    txByte* p = script->symbolsBuffer;
4939
551k
    txID c, i;
4940
551k
    mxDecodeID(p, c);
4941
551k
    the->stack->value.callback.address = C_NULL;
4942
551k
    the->stack->value.IDs = (txID*)fxNewChunk(the, c * sizeof(txID));
4943
551k
    the->stack->kind = XS_IDS_KIND;
4944
551k
    the->stack->value.IDs[0] = XS_NO_ID;
4945
1.77M
    for (i = 1; i < c; i++) {
4946
1.22M
      txID id = fxNewNameC(the, (txString)p);
4947
1.22M
      the->stack->value.IDs[i] = id;
4948
1.22M
      p += mxStringLength((char*)p) + 1;
4949
1.22M
    }
4950
551k
    fxRemapIDs(the, script->codeBuffer, script->codeSize, the->stack->value.IDs);
4951
551k
    the->stack->value.IDs = C_NULL;
4952
551k
  }  
4953
0
  else {
4954
0
    the->stack->value.IDs = C_NULL;
4955
0
    the->stack->kind = XS_IDS_KIND;
4956
0
  }
4957
551k
}
4958
4959
txBoolean fxToNumericInteger(txMachine* the, txSlot* theSlot)
4960
11.3M
{
4961
11.3M
  if (theSlot->kind == XS_REFERENCE_KIND)
4962
301k
    fxToPrimitive(the, theSlot, XS_NUMBER_HINT);
4963
11.3M
  if ((theSlot->kind == XS_BIGINT_KIND) || (theSlot->kind == XS_BIGINT_X_KIND))
4964
1.46M
    return 0;
4965
9.89M
  fxToInteger(the, theSlot);
4966
9.89M
  return 1;
4967
11.3M
}
4968
4969
txBoolean fxToNumericIntegerUnary(txMachine* the, txSlot* a, txBigIntUnary op)
4970
769k
{
4971
769k
  if (fxToNumericInteger(the, a))
4972
492k
    return 1;
4973
277k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint);
4974
277k
  a->kind = XS_BIGINT_KIND;
4975
277k
  the->stack = a;
4976
277k
  return 0;   
4977
769k
}
4978
4979
txBoolean fxToNumericIntegerBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op)
4980
5.29M
{
4981
5.29M
  txBoolean ra = fxToNumericInteger(the, a);
4982
5.29M
  txBoolean rb = fxToNumericInteger(the, b);
4983
5.29M
  if (ra) {
4984
4.70M
    if (rb)
4985
4.69M
      return 1;
4986
4.70M
    mxTypeError("cannot coerce left operand to bigint");
4987
4.70M
  }
4988
596k
  else if (rb)
4989
1.79k
    mxTypeError("cannot coerce right operand to bigint");
4990
594k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint, &b->value.bigint);
4991
594k
  a->kind = XS_BIGINT_KIND;
4992
594k
  the->stack = b;
4993
594k
  return 0;   
4994
5.29M
}
4995
4996
txBoolean fxToNumericNumber(txMachine* the, txSlot* theSlot)
4997
35.2M
{
4998
35.2M
  if (theSlot->kind == XS_REFERENCE_KIND)
4999
3.93M
    fxToPrimitive(the, theSlot, XS_NUMBER_HINT);
5000
35.2M
  if ((theSlot->kind == XS_BIGINT_KIND) || (theSlot->kind == XS_BIGINT_X_KIND))
5001
8.24M
    return 0;
5002
27.0M
  fxToNumber(the, theSlot);
5003
27.0M
  return 1;
5004
35.2M
}
5005
5006
txBoolean fxToNumericNumberUnary(txMachine* the, txSlot* a, txBigIntUnary op)
5007
11.9M
{
5008
11.9M
  if (fxToNumericNumber(the, a))
5009
5.63M
    return 1;
5010
6.30M
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint);
5011
6.30M
  a->kind = XS_BIGINT_KIND;
5012
6.30M
  the->stack = a;
5013
6.30M
  return 0;   
5014
11.9M
}
5015
5016
txBoolean fxToNumericNumberBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op)
5017
10.9M
{
5018
10.9M
  txBoolean ra = fxToNumericNumber(the, a);
5019
10.9M
  txBoolean rb = fxToNumericNumber(the, b);
5020
10.9M
  if (ra) {
5021
9.93M
    if (rb)
5022
9.93M
      return 1;
5023
9.93M
    mxTypeError("cannot coerce left operand to bigint");
5024
9.93M
  }
5025
969k
  else if (rb)
5026
995
    mxTypeError("cannot coerce right operand to bigint");
5027
968k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint, &b->value.bigint);
5028
968k
  a->kind = XS_BIGINT_KIND;
5029
968k
  the->stack = b;
5030
968k
  return 0;   
5031
10.9M
}
5032
5033
void fxRunScript(txMachine* the, txScript* script, txSlot* _this, txSlot* _target, txSlot* closures, txSlot* object, txSlot* module)
5034
551k
{
5035
551k
  if (script) {
5036
551k
    mxTry(the) {
5037
551k
      txSlot* instance;
5038
551k
      txSlot* property;
5039
551k
      __JUMP__.code = C_NULL;
5040
551k
      fxRemapScript(the, script);
5041
551k
      if (script->callback) {
5042
0
        property = the->stack;
5043
        /* THIS */
5044
0
        if (_this)
5045
0
          mxPushSlot(_this);
5046
0
        else
5047
0
          mxPushUndefined();
5048
0
        the->stack->ID = XS_NO_ID;
5049
        /* FUNCTION */
5050
0
        mxPush(mxFunctionPrototype);
5051
0
        instance = fxNewFunctionInstance(the, closures ? mxID(_eval) : XS_NO_ID);
5052
0
        instance->next->kind = XS_CALLBACK_KIND;
5053
0
        instance->next->value.callback.address = script->callback;
5054
0
        instance->next->value.callback.closures = C_NULL;
5055
0
        property = mxFunctionInstanceHome(instance);
5056
0
        property->value.home.object = object;
5057
0
        property->value.home.module = module;
5058
        /* RESULT */
5059
0
        mxPushUndefined();
5060
        /* FRAME */
5061
0
        mxPushUninitialized();
5062
0
        mxRunCount(0);
5063
0
      }
5064
551k
      else {
5065
551k
        mxPushUndefined();
5066
551k
      }
5067
551k
      mxPull(mxHosts);
5068
551k
      mxPop();
5069
5070
      /* TARGET */
5071
551k
      if (_target)
5072
0
        mxPushSlot(_target);
5073
      /* THIS */
5074
551k
      if (_this)
5075
433k
        mxPushSlot(_this);
5076
118k
      else
5077
118k
        mxPushUndefined();
5078
551k
      the->stack->ID = XS_NO_ID;
5079
      /* FUNCTION */
5080
551k
      mxPush(mxFunctionPrototype);
5081
551k
      instance = fxNewFunctionInstance(the, XS_NO_ID);
5082
551k
      instance->next->kind = XS_CODE_X_KIND;
5083
551k
      instance->next->value.code.address = script->codeBuffer;
5084
551k
      instance->next->value.code.closures = closures;
5085
551k
      property = mxFunctionInstanceHome(instance);
5086
551k
      property->ID = fxGenerateProfileID(the);
5087
551k
      property->value.home.object = object;
5088
551k
      property->value.home.module = module;
5089
      /* RESULT */
5090
551k
            mxPushUndefined();
5091
      /* FRAME */
5092
551k
      mxPushUninitialized();
5093
551k
      if (_target)
5094
0
        the->stack->flag |= XS_TARGET_FLAG;
5095
551k
      mxRunCount(0);
5096
5097
551k
      mxPushUndefined();
5098
551k
      mxPull(mxHosts);
5099
551k
      if (script->symbolsBuffer)
5100
95.0k
        fxDeleteScript(script);
5101
551k
    }
5102
551k
    mxCatch(the) {
5103
455k
      if (script->symbolsBuffer)
5104
455k
        fxDeleteScript(script);
5105
455k
      fxJump(the);
5106
455k
    }
5107
551k
  }
5108
0
  else {
5109
0
    mxSyntaxError("invalid script");
5110
0
  }
5111
551k
}
5112
5113
void fxRunUsed(txMachine* the, txSlot* selector)
5114
0
{
5115
0
#if mxExplicitResourceManagement
5116
0
  txSlot* exception = selector + 1;
5117
0
  fxBeginHost(the);
5118
0
  {
5119
0
    if (selector->value.integer == 0) {
5120
0
      mxPush(mxSuppressedErrorConstructor);
5121
0
      mxNew();
5122
0
      mxPush(mxException);
5123
0
      mxPushSlot(exception);
5124
0
      mxRunCount(2);
5125
0
      mxPullSlot(exception);
5126
0
    }
5127
0
    else {
5128
0
      *exception = mxException;
5129
0
      selector->value.integer = 0;
5130
0
    }
5131
0
    mxException = mxUndefined;
5132
0
  }
5133
0
  fxEndHost(the);
5134
#else
5135
  mxTypeError("using: unavailable feature");
5136
#endif
5137
0
}
5138
5139
void fxRunUsing(txMachine* the)
5140
0
{
5141
0
#if mxExplicitResourceManagement
5142
0
  txSlot* resource = the->stack;
5143
0
  fxBeginHost(the);
5144
0
  mxPushSlot(resource);
5145
0
  if (!mxIsNull(resource) && !mxIsUndefined(resource)) {
5146
0
    mxGetID(mxID(_Symbol_dispose));
5147
0
    if (!fxIsCallable(the, the->stack))
5148
0
      mxTypeError("using: [Symbol.dispose] is not a function");
5149
0
  }
5150
0
  else
5151
0
    the->stack->kind = XS_NULL_KIND;
5152
0
  mxPullSlot(resource);
5153
0
  fxEndHost(the);
5154
#else
5155
  mxTypeError("using: unavailable feature");
5156
#endif
5157
0
}
5158
5159
void fxRunUsingAsync(txMachine* the)
5160
0
{
5161
0
#if mxExplicitResourceManagement
5162
0
  txSlot* resource = the->stack;
5163
0
  fxBeginHost(the);
5164
0
  mxPushSlot(resource);
5165
0
  if (!mxIsNull(resource) && !mxIsUndefined(resource)) {
5166
0
    mxGetID(mxID(_Symbol_asyncDispose));
5167
0
    if (!fxIsCallable(the, the->stack)) {
5168
0
      mxPop();
5169
0
      mxPushSlot(resource);
5170
0
      mxGetID(mxID(_Symbol_dispose));
5171
0
    }
5172
0
    if (!fxIsCallable(the, the->stack))
5173
0
      mxTypeError("using: neither [Symbol.asyncDispose] nor [Symbol.dispose] are function");
5174
0
  }
5175
0
  else
5176
0
    the->stack->kind = XS_NULL_KIND;
5177
0
  mxPullSlot(resource);
5178
0
  fxEndHost(the);
5179
#else
5180
  mxTypeError("using: unavailable feature");
5181
#endif
5182
0
}
5183
5184
#ifdef mxMetering
5185
void fxCheckMeter(void* console)
5186
0
{
5187
0
  txMachine* the = console;
5188
0
  if (the->meterInterval && (the->meterIndex > the->meterCount)) {
5189
0
    fxCheckMetering(the);
5190
0
  }
5191
0
}
5192
void fxMeterSome(void* console, txU4 count)
5193
551k
{
5194
551k
  txMachine* the = console;
5195
551k
  the->meterIndex += count * XS_PARSE_CODE_METERING;
5196
551k
}
5197
#endif
5198
5199
5200
5201
5202
5203
5204
5205