Coverage Report

Created: 2026-08-13 06:36

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.60G
      the->meterIndex += XS_CODE_METERING; \
81
1.60G
      goto *bytes[byte]
82
  #else
83
    #define mxBreak \
84
      goto *bytes[byte]
85
  #endif
86
1.67G
  #define mxCase(OPCODE) OPCODE:
87
651k
  #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
5.95G
#define mxCode code
104
3.79G
#define mxFrame frame
105
839M
#define mxEnvironment environment
106
1.54G
#define mxScope scope
107
7.07G
#define mxStack stack
108
109
153M
#define mxFrameEnd (mxFrame + ((mxFrame->flag & XS_TARGET_FLAG) ? 5 : 4))
110
15.1M
#define mxFrameThis (mxFrame + 3)
111
2.70M
#define mxFrameFunction (mxFrame + 2)
112
202M
#define mxFrameResult (mxFrame + 1)
113
3.96k
#define mxFrameTarget (mxFrame + 4)
114
22.7M
#define mxFrameHasTarget (mxFrame->flag & XS_TARGET_FLAG)
115
5.53M
#define mxFrameArgc ((txInteger)(mxFrame->ID))
116
4.94M
#define mxFrameArgv(THE_INDEX) (mxFrame - 1 - (THE_INDEX))
117
118
381M
#define mxRestoreState { \
119
381M
  mxStack = the->stack; \
120
381M
  mxScope = the->scope; \
121
381M
  mxFrame = the->frame; \
122
381M
  mxEnvironment = mxFrameToEnvironment(mxFrame); \
123
381M
  mxCode = the->code; \
124
381M
}
125
30.6M
#define mxRestoreStateKeepStack { \
126
30.6M
  mxScope = the->scope; \
127
30.6M
  mxFrame = the->frame; \
128
30.6M
  mxEnvironment = mxFrameToEnvironment(mxFrame); \
129
30.6M
  mxCode = the->code; \
130
30.6M
}
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
491M
  #define mxSaveState { \
147
491M
    the->stack = mxStack; \
148
491M
    the->scope = mxScope; \
149
491M
    the->frame = mxFrame; \
150
491M
    the->code = mxCode; \
151
491M
  }
152
30.6M
  #define mxSaveStateKeepStack { \
153
30.6M
    the->scope = mxScope; \
154
30.6M
    the->frame = mxFrame; \
155
30.6M
    the->code = mxCode; \
156
30.6M
  }
157
#endif
158
159
#if mxBoundsCheck
160
#define mxAllocStack(_COUNT) \
161
878M
  if ((mxStack - _COUNT) < the->stackBottom) \
162
878M
    goto STACK_OVERFLOW; \
163
878M
  mxStack -= _COUNT
164
#else
165
#define mxAllocStack(_COUNT) \
166
  mxStack -= _COUNT
167
#endif
168
169
597M
#define mxPushKind(_KIND) { \
170
597M
  mxAllocStack(1); \
171
597M
  mxStack->next = C_NULL;  \
172
597M
  mxInitSlotKind(mxStack, _KIND); \
173
597M
}
174
175
8.59M
#define mxRunDebug(_ERROR, ...) { \
176
8.59M
  mxSaveState; \
177
8.59M
  fxThrowMessage(the, NULL, 0, _ERROR, __VA_ARGS__); \
178
8.59M
}
179
180
258
#define mxRunDebugID(_ERROR, _MESSAGE, _ID) { \
181
973k
  mxSaveState; \
182
258
  fxIDToString(the, _ID, the->nameBuffer, sizeof(the->nameBuffer)); \
183
258
  fxThrowMessage(the, NULL, 0, _ERROR, _MESSAGE, the->nameBuffer); \
184
973k
}
185
186
#define mxToBoolean(SLOT) \
187
6.74M
  if (XS_BOOLEAN_KIND != (SLOT)->kind) { \
188
5.29M
    if (XS_SYMBOL_KIND <= (SLOT)->kind) { \
189
1.06M
      mxSaveState; \
190
1.06M
      fxToBoolean(the, SLOT); \
191
1.06M
      mxRestoreState; \
192
1.06M
    } \
193
5.29M
    else \
194
5.29M
      fxToBoolean(the, SLOT); \
195
5.29M
  }
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.28M
  if (XS_NUMBER_KIND != (SLOT)->kind) { \
210
1.98M
    if (XS_STRING_KIND <= (SLOT)->kind) { \
211
1.81M
      mxSaveState; \
212
1.81M
      fxToNumber(the, SLOT); \
213
1.81M
      mxRestoreState; \
214
1.81M
    } \
215
1.98M
    else \
216
1.98M
      fxToNumber(the, SLOT); \
217
1.98M
  }
218
  
219
#define mxToString(SLOT) \
220
4.34M
  if ((XS_STRING_KIND != (SLOT)->kind) && (XS_STRING_X_KIND != (SLOT)->kind)) { \
221
3.50M
    mxSaveState; \
222
3.50M
    fxToString(the, SLOT); \
223
3.50M
    mxRestoreState; \
224
3.50M
  }
225
  
226
#define mxToInstance(SLOT) \
227
265M
  if (XS_REFERENCE_KIND != (SLOT)->kind) { \
228
22.6M
    mxSaveState; \
229
22.6M
    variable = fxToInstance(the, SLOT); \
230
22.6M
    mxRestoreState; \
231
22.6M
    primitive = 1; \
232
22.6M
  } \
233
265M
  else { \
234
243M
    variable = (SLOT)->value.reference; \
235
243M
    primitive = 0; \
236
243M
  }
237
238
#ifndef mxUnalignedAccess
239
  #define mxUnalignedAccess 1
240
#endif
241
242
216M
#define mxRunS1(OFFSET) ((txS1*)mxCode)[OFFSET]
243
228M
#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
150M
    #define mxRunS2(OFFSET) *((txS2*)(mxCode + OFFSET))
251
410M
    #define mxRunS4(OFFSET) *((txS4*)(mxCode + OFFSET))
252
4.93M
    #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
400M
  #define mxRunID(OFFSET) mxRunS4(OFFSET)
261
#else
262
  #define mxRunID(OFFSET) mxRunS2(OFFSET)
263
#endif
264
265
1.55G
#define mxNextCode(OFFSET) { \
266
1.55G
  mxCode += OFFSET; \
267
1.55G
  byte = *((txU1*)mxCode); \
268
1.55G
}
269
81.3M
#define mxSkipCode(OFFSET) { \
270
81.3M
  mxCode += OFFSET; \
271
81.3M
}
272
273
#ifdef mxMetering
274
  #define mxCheckMeter() \
275
106M
    if (the->meterInterval && (the->meterIndex > the->meterCount)) { \
276
25.5k
      mxSaveState; \
277
25.5k
      fxCheckMetering(the); \
278
25.5k
      mxRestoreState; \
279
25.5k
    }
280
  #define mxBranch(INDEX, OFFSET) \
281
57.6M
    if ((OFFSET) < 0) { \
282
46.1M
      mxCheckMeter(); \
283
46.1M
    } \
284
57.6M
    mxNextCode((txS4)INDEX + OFFSET)
285
  #define mxBranchElse(TEST, INDEX, OFFSET) \
286
34.8M
    if (TEST) { \
287
28.3M
      mxNextCode((txS4)INDEX); \
288
28.3M
    } \
289
32.3M
    else { \
290
4.02M
      mxBranch(INDEX, OFFSET); \
291
4.02M
    }
292
  #define mxBranchIf(TEST, INDEX, OFFSET) \
293
30.3M
    if (TEST) { \
294
5.35M
      mxBranch(INDEX, OFFSET); \
295
5.35M
    } \
296
20.2M
    else { \
297
14.9M
      mxNextCode((txS4)index); \
298
14.9M
    }
299
  #define mxFirstCode() \
300
60.6M
    mxCheckMeter(); \
301
60.6M
    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
101M
{
422
101M
  register txSlot* stack = the->stack;
423
101M
  register txSlot* scope = the->scope;
424
101M
  register txSlot* frame = the->frame;
425
101M
  register txSlot* environment;
426
101M
  register txByte* code = the->code;
427
101M
  register txSlot* variable;
428
101M
  register txSlot* slot;
429
101M
  register txU1 byte = 0;
430
101M
  register txU4 index;
431
101M
  register txS4 offset;
432
101M
  txU1 primitive = 0;
433
101M
  txU1 ignore = 0;
434
101M
#if defined(__GNUC__) && defined(__OPTIMIZE__)
435
101M
  static void *const
436
101M
  #if !defined(__ets__) || ESP32
437
101M
    ICACHE_RAM_ATTR
438
101M
  #endif
439
101M
    gxBytes[] = {
440
101M
    &&XS_NO_CODE,
441
101M
    &&XS_CODE_ADD,
442
101M
    &&XS_CODE_ARGUMENT,
443
101M
    &&XS_CODE_ARGUMENTS,
444
101M
    &&XS_CODE_ARGUMENTS_SLOPPY,
445
101M
    &&XS_CODE_ARGUMENTS_STRICT,
446
101M
    &&XS_CODE_ARRAY,
447
101M
    &&XS_CODE_ASYNC_FUNCTION,
448
101M
    &&XS_CODE_ASYNC_GENERATOR_FUNCTION,
449
101M
    &&XS_CODE_AT,
450
101M
    &&XS_CODE_AWAIT,
451
101M
    &&XS_CODE_BEGIN_SLOPPY,
452
101M
    &&XS_CODE_BEGIN_STRICT,
453
101M
    &&XS_CODE_BEGIN_STRICT_BASE,
454
101M
    &&XS_CODE_BEGIN_STRICT_DERIVED,
455
101M
    &&XS_CODE_BEGIN_STRICT_FIELD,
456
101M
    &&XS_CODE_BIGINT_1,
457
101M
    &&XS_CODE_BIGINT_2,
458
101M
    &&XS_CODE_BIT_AND,
459
101M
    &&XS_CODE_BIT_NOT,
460
101M
    &&XS_CODE_BIT_OR,
461
101M
    &&XS_CODE_BIT_XOR,
462
101M
    &&XS_CODE_BRANCH_1,
463
101M
    &&XS_CODE_BRANCH_2,
464
101M
    &&XS_CODE_BRANCH_4,
465
101M
    &&XS_CODE_BRANCH_CHAIN_1,
466
101M
    &&XS_CODE_BRANCH_CHAIN_2,
467
101M
    &&XS_CODE_BRANCH_CHAIN_4,
468
101M
    &&XS_CODE_BRANCH_COALESCE_1,
469
101M
    &&XS_CODE_BRANCH_COALESCE_2,
470
101M
    &&XS_CODE_BRANCH_COALESCE_4,
471
101M
    &&XS_CODE_BRANCH_ELSE_1,
472
101M
    &&XS_CODE_BRANCH_ELSE_2,
473
101M
    &&XS_CODE_BRANCH_ELSE_4,
474
101M
    &&XS_CODE_BRANCH_IF_1,
475
101M
    &&XS_CODE_BRANCH_IF_2,
476
101M
    &&XS_CODE_BRANCH_IF_4,
477
101M
    &&XS_CODE_BRANCH_STATUS_1,
478
101M
    &&XS_CODE_BRANCH_STATUS_2,
479
101M
    &&XS_CODE_BRANCH_STATUS_4,
480
101M
    &&XS_CODE_CALL,
481
101M
    &&XS_CODE_CATCH_1,
482
101M
    &&XS_CODE_CATCH_2,
483
101M
    &&XS_CODE_CATCH_4,
484
101M
    &&XS_CODE_CHECK_INSTANCE,
485
101M
    &&XS_CODE_CLASS,
486
101M
    &&XS_CODE_CODE_1,
487
101M
    &&XS_CODE_CODE_2,
488
101M
    &&XS_CODE_CODE_4,
489
101M
    &&XS_CODE_CODE_ARCHIVE_1,
490
101M
    &&XS_CODE_CODE_ARCHIVE_2,
491
101M
    &&XS_CODE_CODE_ARCHIVE_4,
492
101M
    &&XS_CODE_CONST_CLOSURE_1,
493
101M
    &&XS_CODE_CONST_CLOSURE_2,
494
101M
    &&XS_CODE_CONST_LOCAL_1,
495
101M
    &&XS_CODE_CONST_LOCAL_2,
496
101M
    &&XS_CODE_CONSTRUCTOR_FUNCTION,
497
101M
    &&XS_CODE_COPY_OBJECT,
498
101M
    &&XS_CODE_CURRENT,
499
101M
    &&XS_CODE_DEBUGGER,
500
101M
    &&XS_CODE_DECREMENT,
501
101M
    &&XS_CODE_DELETE_PROPERTY,
502
101M
    &&XS_CODE_DELETE_PROPERTY_AT,
503
101M
    &&XS_CODE_DELETE_SUPER,
504
101M
    &&XS_CODE_DELETE_SUPER_AT,
505
101M
    &&XS_CODE_DIVIDE,
506
101M
    &&XS_CODE_DUB,
507
101M
    &&XS_CODE_DUB_AT,
508
101M
    &&XS_CODE_END,
509
101M
    &&XS_CODE_END_ARROW,
510
101M
    &&XS_CODE_END_BASE,
511
101M
    &&XS_CODE_END_DERIVED,
512
101M
    &&XS_CODE_ENVIRONMENT,
513
101M
    &&XS_CODE_EQUAL,
514
101M
    &&XS_CODE_EVAL,
515
101M
    &&XS_CODE_EVAL_ENVIRONMENT,
516
101M
    &&XS_CODE_EVAL_PRIVATE,
517
101M
    &&XS_CODE_EVAL_REFERENCE,
518
101M
    &&XS_CODE_EVAL_TAIL,
519
101M
    &&XS_CODE_EXCEPTION,
520
101M
    &&XS_CODE_EXPONENTIATION,
521
101M
    &&XS_CODE_EXTEND,
522
101M
    &&XS_CODE_FALSE,
523
101M
    &&XS_CODE_FILE,
524
101M
    &&XS_CODE_FOR_AWAIT_OF,
525
101M
    &&XS_CODE_FOR_IN,
526
101M
    &&XS_CODE_FOR_OF,
527
101M
    &&XS_CODE_FUNCTION,
528
101M
    &&XS_CODE_FUNCTION_ENVIRONMENT,
529
101M
    &&XS_CODE_GENERATOR_FUNCTION,
530
101M
    &&XS_CODE_GET_CLOSURE_1,
531
101M
    &&XS_CODE_GET_CLOSURE_2,
532
101M
    &&XS_CODE_GET_LOCAL_1,
533
101M
    &&XS_CODE_GET_LOCAL_2,
534
101M
    &&XS_CODE_GET_PRIVATE_1,
535
101M
    &&XS_CODE_GET_PRIVATE_2,
536
101M
    &&XS_CODE_GET_PROPERTY,
537
101M
    &&XS_CODE_GET_PROPERTY_AT,
538
101M
    &&XS_CODE_GET_RESULT,
539
101M
    &&XS_CODE_GET_SUPER,
540
101M
    &&XS_CODE_GET_SUPER_AT,
541
101M
    &&XS_CODE_GET_THIS,
542
101M
    &&XS_CODE_GET_VARIABLE,
543
101M
    &&XS_CODE_GET_THIS_VARIABLE,
544
101M
    &&XS_CODE_GLOBAL,
545
101M
    &&XS_CODE_HAS_PRIVATE_1,
546
101M
    &&XS_CODE_HAS_PRIVATE_2,
547
101M
    &&XS_CODE_HOST,
548
101M
    &&XS_CODE_IMPORT,
549
101M
    &&XS_CODE_IMPORT_META,
550
101M
    &&XS_CODE_IN,
551
101M
    &&XS_CODE_INCREMENT,
552
101M
    &&XS_CODE_INSTANCEOF,
553
101M
    &&XS_CODE_INSTANTIATE,
554
101M
    &&XS_CODE_INTEGER_1,
555
101M
    &&XS_CODE_INTEGER_2,
556
101M
    &&XS_CODE_INTEGER_4,
557
101M
    &&XS_CODE_LEFT_SHIFT,
558
101M
    &&XS_CODE_LESS,
559
101M
    &&XS_CODE_LESS_EQUAL,
560
101M
    &&XS_CODE_LET_CLOSURE_1,
561
101M
    &&XS_CODE_LET_CLOSURE_2,
562
101M
    &&XS_CODE_LET_LOCAL_1,
563
101M
    &&XS_CODE_LET_LOCAL_2,
564
101M
    &&XS_CODE_LINE,
565
101M
    &&XS_CODE_MINUS,
566
101M
    &&XS_CODE_MODULE,
567
101M
    &&XS_CODE_MODULO,
568
101M
    &&XS_CODE_MORE,
569
101M
    &&XS_CODE_MORE_EQUAL,
570
101M
    &&XS_CODE_MULTIPLY,
571
101M
    &&XS_CODE_NAME,
572
101M
    &&XS_CODE_NEW,
573
101M
    &&XS_CODE_NEW_CLOSURE,
574
101M
    &&XS_CODE_NEW_LOCAL,
575
101M
    &&XS_CODE_NEW_PRIVATE_1,
576
101M
    &&XS_CODE_NEW_PRIVATE_2,
577
101M
    &&XS_CODE_NEW_PROPERTY,
578
101M
    &&XS_CODE_NEW_PROPERTY_AT,
579
101M
    &&XS_CODE_NEW_TEMPORARY,
580
101M
    &&XS_CODE_NOT,
581
101M
    &&XS_CODE_NOT_EQUAL,
582
101M
    &&XS_CODE_NULL,
583
101M
    &&XS_CODE_NUMBER,
584
101M
    &&XS_CODE_OBJECT,
585
101M
    &&XS_CODE_PLUS,
586
101M
    &&XS_CODE_POP,
587
101M
    &&XS_CODE_PROGRAM_ENVIRONMENT,
588
101M
    &&XS_CODE_PROGRAM_REFERENCE,
589
101M
    &&XS_CODE_PULL_CLOSURE_1,
590
101M
    &&XS_CODE_PULL_CLOSURE_2,
591
101M
    &&XS_CODE_PULL_LOCAL_1,
592
101M
    &&XS_CODE_PULL_LOCAL_2,
593
101M
    &&XS_CODE_REFRESH_CLOSURE_1,
594
101M
    &&XS_CODE_REFRESH_CLOSURE_2,
595
101M
    &&XS_CODE_REFRESH_LOCAL_1,
596
101M
    &&XS_CODE_REFRESH_LOCAL_2,
597
101M
    &&XS_CODE_REGEXP,
598
101M
    &&XS_CODE_RESERVE_1,
599
101M
    &&XS_CODE_RESERVE_2,
600
101M
    &&XS_CODE_RESET_CLOSURE_1,
601
101M
    &&XS_CODE_RESET_CLOSURE_2,
602
101M
    &&XS_CODE_RESET_LOCAL_1,
603
101M
    &&XS_CODE_RESET_LOCAL_2,
604
101M
    &&XS_CODE_RETHROW,
605
101M
    &&XS_CODE_RETRIEVE_1,
606
101M
    &&XS_CODE_RETRIEVE_2,
607
101M
    &&XS_CODE_RETRIEVE_TARGET,
608
101M
    &&XS_CODE_RETRIEVE_THIS,
609
101M
    &&XS_CODE_RETURN,
610
101M
    &&XS_CODE_RUN,
611
101M
    &&XS_CODE_RUN_1,
612
101M
    &&XS_CODE_RUN_2,
613
101M
    &&XS_CODE_RUN_4,
614
101M
    &&XS_CODE_RUN_TAIL,
615
101M
    &&XS_CODE_RUN_TAIL_1,
616
101M
    &&XS_CODE_RUN_TAIL_2,
617
101M
    &&XS_CODE_RUN_TAIL_4,
618
101M
    &&XS_CODE_SET_CLOSURE_1,
619
101M
    &&XS_CODE_SET_CLOSURE_2,
620
101M
    &&XS_CODE_SET_HOME,
621
101M
    &&XS_CODE_SET_LOCAL_1,
622
101M
    &&XS_CODE_SET_LOCAL_2,
623
101M
    &&XS_CODE_SET_PRIVATE_1,
624
101M
    &&XS_CODE_SET_PRIVATE_2,
625
101M
    &&XS_CODE_SET_PROPERTY,
626
101M
    &&XS_CODE_SET_PROPERTY_AT,
627
101M
    &&XS_CODE_SET_RESULT,
628
101M
    &&XS_CODE_SET_SUPER,
629
101M
    &&XS_CODE_SET_SUPER_AT,
630
101M
    &&XS_CODE_SET_THIS,
631
101M
    &&XS_CODE_SET_VARIABLE,
632
101M
    &&XS_CODE_SIGNED_RIGHT_SHIFT,
633
101M
    &&XS_CODE_START_ASYNC,
634
101M
    &&XS_CODE_START_ASYNC_GENERATOR,
635
101M
    &&XS_CODE_START_GENERATOR,
636
101M
    &&XS_CODE_STORE_1,
637
101M
    &&XS_CODE_STORE_2,
638
101M
    &&XS_CODE_STORE_ARROW,
639
101M
    &&XS_CODE_STRICT_EQUAL,
640
101M
    &&XS_CODE_STRICT_NOT_EQUAL,
641
101M
    &&XS_CODE_STRING_1,
642
101M
    &&XS_CODE_STRING_2,
643
101M
    &&XS_CODE_STRING_4,
644
101M
    &&XS_CODE_STRING_ARCHIVE_1,
645
101M
    &&XS_CODE_STRING_ARCHIVE_2,
646
101M
    &&XS_CODE_STRING_ARCHIVE_4,
647
101M
    &&XS_CODE_SUBTRACT,
648
101M
    &&XS_CODE_SUPER,
649
101M
    &&XS_CODE_SWAP,
650
101M
    &&XS_CODE_SYMBOL,
651
101M
    &&XS_CODE_TARGET,
652
101M
    &&XS_CODE_TEMPLATE,
653
101M
    &&XS_CODE_TEMPLATE_CACHE,
654
101M
    &&XS_CODE_THIS,
655
101M
    &&XS_CODE_THROW,
656
101M
    &&XS_CODE_THROW_STATUS,
657
101M
    &&XS_CODE_TO_INSTANCE,
658
101M
    &&XS_CODE_TO_NUMERIC,
659
101M
    &&XS_CODE_TO_STRING,
660
101M
    &&XS_CODE_TRANSFER,
661
101M
    &&XS_CODE_TRUE,
662
101M
    &&XS_CODE_TYPEOF,
663
101M
    &&XS_CODE_UNCATCH,
664
101M
    &&XS_CODE_UNDEFINED,
665
101M
    &&XS_CODE_UNSIGNED_RIGHT_SHIFT,
666
101M
    &&XS_CODE_UNWIND_1,
667
101M
    &&XS_CODE_UNWIND_2,
668
101M
    &&XS_CODE_VAR_CLOSURE_1,
669
101M
    &&XS_CODE_VAR_CLOSURE_2,
670
101M
    &&XS_CODE_VAR_LOCAL_1,
671
101M
    &&XS_CODE_VAR_LOCAL_2,
672
101M
    &&XS_CODE_VOID,
673
101M
    &&XS_CODE_WITH,
674
101M
    &&XS_CODE_WITHOUT,
675
101M
    &&XS_CODE_YIELD,
676
101M
    &&XS_CODE_PROFILE,
677
101M
    &&XS_CODE_YIELD_STAR,
678
101M
    &&XS_CODE_USED_1,
679
101M
    &&XS_CODE_USED_2,
680
101M
    &&XS_CODE_USING,
681
101M
    &&XS_CODE_USING_ASYNC,
682
101M
    &&XS_CODE_AT_2,
683
101M
    &&XS_CODE_SUPER_AT,
684
101M
    &&XS_CODE_SUPER_AT_2,
685
101M
    &&XS_CODE_TRANSFER_JSON,
686
101M
  };
687
101M
  register void * const *bytes = gxBytes;
688
101M
#endif
689
101M
  txJump* jump = C_NULL;
690
101M
  txSlot scratch;
691
101M
  txSlot** address;
692
101M
  txJump* yieldJump = the->firstJump;
693
694
101M
  mxCheckCStack();
695
101M
  if (generator) {
696
651k
    slot = mxStack;
697
651k
    variable = generator->next;
698
651k
    offset = variable->value.stack.length;
699
651k
    mxAllocStack(offset);
700
651k
    c_memcpy(mxStack, variable->value.stack.address, offset * sizeof(txSlot));
701
651k
    mxCode = (mxStack++)->value.reference->next->value.code.address;
702
651k
    offset = (mxStack++)->value.integer;
703
651k
    while (offset) {
704
37
      jump = c_malloc(sizeof(txJump));
705
37
      if (jump) {
706
37
        jump->nextJump = the->firstJump;
707
37
        jump->stack = slot - (mxStack++)->value.integer;
708
37
        jump->frame = slot - (mxStack++)->value.integer;
709
37
        jump->scope = slot - (mxStack++)->value.integer;
710
37
        jump->code = mxCode + (mxStack++)->value.integer;
711
37
        jump->flag = 1;
712
37
                the->firstJump = jump;
713
37
        if (c_setjmp(jump->buffer) == 1) {
714
15
          jump = the->firstJump;
715
15
                    the->firstJump = jump->nextJump;
716
15
          mxStack = jump->stack;
717
15
          mxScope = jump->scope;
718
15
          mxFrame = jump->frame;
719
15
          mxEnvironment = mxFrameToEnvironment(mxFrame);
720
15
          mxCode = jump->code;
721
15
          c_free(jump);
722
15
          goto XS_CODE_JUMP;
723
15
        }
724
37
      }
725
0
      else {
726
0
        mxSaveState;
727
0
        fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
728
0
      }
729
22
      offset--;
730
22
    }
731
651k
    variable = slot - (mxStack++)->value.integer;
732
651k
    variable->next = mxFrame;
733
651k
    variable->value.frame.code = the->code;
734
651k
    variable->value.frame.scope = mxScope;
735
651k
    mxFrame = variable;
736
651k
    mxEnvironment = mxFrameToEnvironment(mxFrame);
737
651k
    mxScope = slot - (mxStack++)->value.integer;
738
651k
    mxCode = mxCode + (mxStack++)->value.integer;
739
651k
    mxStack->kind = the->scratch.kind;
740
651k
    mxStack->value = the->scratch.value;
741
#ifdef mxTraceCall
742
    fxTraceCallBegin(the, mxFrameFunction);
743
#endif
744
651k
XS_CODE_JUMP:
745
651k
    mxFirstCode();
746
651k
  }
747
100M
  else {
748
100M
    offset = count;
749
100M
    goto XS_CODE_RUN_ALL;
750
100M
  }
751
651k
  for (;;) {
752
753
#ifdef mxTrace
754
    if (gxDoTrace) fxTraceCode(the, stack, byte);
755
#endif
756
651k
#ifdef mxMetering
757
651k
    the->meterIndex += XS_CODE_METERING;
758
651k
#endif
759
    
760
651k
    mxSwitch(byte) {
761
651k
    mxCase(XS_NO_CODE)
762
0
      mxBreak;
763
764
910k
    mxCase(XS_CODE_RUN_TAIL)
765
910k
      mxSkipCode(1);
766
910k
      offset = mxStack->value.integer;
767
910k
      mxStack++;
768
910k
      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
13.8k
    mxCase(XS_CODE_RUN_TAIL_1)
778
13.8k
      offset = mxRunS1(1);
779
13.8k
      mxSkipCode(2);
780
923k
    XS_CODE_RUN_TAIL_ALL:
781
923k
      if (mxFrameHasTarget)
782
3
        goto XS_CODE_RUN_ALL;
783
923k
#ifdef mxDebug
784
923k
      slot = mxStack + offset + 2;
785
923k
      if (!fxIsCallable(the, slot))
786
1.10k
        goto XS_CODE_RUN_ALL;
787
922k
#endif
788
922k
      variable = mxFrameEnd - 4 - offset;
789
922k
      mxScope = mxFrame->value.frame.scope;
790
922k
      mxCode = mxFrame->value.frame.code;
791
922k
      mxFrame = mxFrame->next;
792
922k
      c_memmove(variable, mxStack, (4 + offset) * sizeof(txSlot));
793
922k
      mxStack = variable;
794
922k
      goto XS_CODE_RUN_ALL;
795
796
19.5k
    mxCase(XS_CODE_RUN)
797
19.5k
      mxSkipCode(1);
798
19.5k
      offset = mxStack->value.integer;
799
19.5k
      mxStack++;
800
19.5k
      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
17.1k
    mxCase(XS_CODE_RUN_2)
806
17.1k
      offset = mxRunS2(1);
807
17.1k
      mxSkipCode(3);
808
17.1k
      goto XS_CODE_RUN_ALL;
809
43.1M
    mxCase(XS_CODE_RUN_1)
810
43.1M
      offset = mxRunS1(1);
811
43.1M
      mxSkipCode(2);
812
154M
    XS_CODE_RUN_ALL:
813
#ifdef mxTrace
814
      if (gxDoTrace) fxTraceInteger(the, offset);
815
#endif
816
154M
      slot = mxStack + offset;
817
      // FRAME
818
154M
      slot->kind = XS_FRAME_KIND;
819
154M
      slot->next = mxFrame;
820
154M
      slot->flag = slot->flag & XS_TARGET_FLAG;
821
154M
      slot->ID = (txID)offset; // COUNT
822
154M
#ifdef mxDebug
823
154M
      if (mxFrame && (mxFrame->flag & XS_STEP_INTO_FLAG))
824
0
        slot->flag |= XS_STEP_INTO_FLAG | XS_STEP_OVER_FLAG;
825
154M
#endif
826
154M
      slot->value.frame.code = mxCode;
827
154M
      slot->value.frame.scope = mxScope;
828
154M
      slot++;
829
      // RESULT
830
154M
      slot++;
831
      // FUNCTION
832
154M
      byte = ((slot + 1)->kind == XS_UNINITIALIZED_KIND) ? 1 : 0;
833
154M
      if (byte)
834
7.01M
        (mxStack + offset)->flag |= XS_TARGET_FLAG;
835
154M
      if (slot->kind == XS_REFERENCE_KIND) {
836
154M
        variable = slot->value.reference;
837
154M
        slot = variable->next;
838
154M
        if (slot && (slot->flag & XS_INTERNAL_FLAG)) {
839
154M
          if ((slot->kind == XS_CODE_KIND) || (slot->kind == XS_CODE_X_KIND)) {
840
8.46M
            if (byte && !mxIsConstructor(variable))
841
8.46M
              mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
842
8.46M
            variable = slot->value.code.closures;
843
8.46M
            if (variable) {
844
3.08M
              mxPushKind(XS_REFERENCE_KIND);
845
3.08M
              mxStack->value.environment.variable.reference = variable;
846
3.08M
            }
847
5.37M
            else {
848
5.37M
              mxPushKind(XS_NULL_KIND);
849
5.37M
              mxStack->value.environment.variable.reference = C_NULL;
850
5.37M
            }
851
8.46M
      #ifdef mxDebug
852
8.46M
            mxStack->ID = XS_NO_ID;
853
8.46M
            mxStack->value.environment.line = 0;
854
8.46M
      #endif
855
8.46M
            mxFrame = mxStack + 1 + offset;
856
8.46M
            mxEnvironment = mxStack;
857
8.46M
            mxScope = mxStack;
858
8.46M
            mxCode = slot->value.code.address;
859
      #ifdef mxTraceCall
860
            fxTraceCallBegin(the, mxFrameFunction);
861
      #endif
862
8.46M
            mxFirstCode();
863
8.46M
            mxBreak;
864
8.46M
          }
865
154M
          if ((slot->kind == XS_CALLBACK_KIND) || (slot->kind == XS_CALLBACK_X_KIND)) {
866
145M
            if (byte && !mxIsConstructor(variable))
867
145M
              mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
868
145M
            mxPushKind(XS_VAR_KIND);
869
145M
            mxStack->value.environment.variable.count = 0;
870
145M
      #ifdef mxDebug
871
145M
            mxStack->ID = XS_NO_ID;
872
145M
            mxStack->value.environment.line = 0;
873
145M
      #endif
874
145M
            mxFrame = mxStack + 1 + offset;
875
145M
            mxFrame->flag |= XS_C_FLAG;
876
145M
            mxScope = mxStack;
877
145M
            mxCode = C_NULL;
878
145M
            byte = XS_CODE_CALL;
879
      #ifdef mxTraceCall
880
            fxTraceCallBegin(the, mxFrameFunction);
881
      #endif
882
145M
            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
145M
            if (slot->flag & XS_BASE_FLAG)
888
0
              fxRunBase(the);
889
145M
            else if (slot->flag & XS_DERIVED_FLAG)
890
0
              fxRunDerived(the);
891
145M
            (*(slot->value.callback.address))(the);
892
145M
            mxRestoreState;
893
145M
            if (mxCode) {
894
910k
              byte = *mxCode;
895
910k
              mxBreak;
896
910k
            }
897
145M
      #if defined(mxInstrument) || defined(mxProfile)
898
145M
            fxCheckProfiler(the, mxFrame);
899
145M
      #endif
900
145M
            if (slot->flag & XS_BASE_FLAG)
901
0
              goto XS_CODE_END_BASE_ALL;
902
145M
            if (slot->flag & XS_DERIVED_FLAG)
903
0
              goto XS_CODE_END_DERIVED_ALL;
904
145M
            slot = mxFrameResult;
905
145M
            goto XS_CODE_END_ALL;
906
145M
          }
907
8.58M
          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
8.58M
        }
929
154M
      }
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
8.59M
      if (byte) {
964
3.80k
        mxRunDebug(XS_TYPE_ERROR, "new: not a constructor");
965
0
      }
966
8.58M
      else {
967
8.58M
        mxRunDebug(XS_TYPE_ERROR, "call: not a function");
968
0
      }
969
0
      mxBreak;
970
      
971
6.84M
    mxCase(XS_CODE_BEGIN_SLOPPY)
972
6.84M
            if (mxFrameHasTarget && (mxFrameFunction->value.reference->flag & XS_CAN_CONSTRUCT_FLAG)) {
973
121k
        mxSaveState;
974
121k
        fxRunConstructor(the);
975
121k
        mxRestoreState;
976
121k
      }
977
6.72M
      else {
978
6.72M
        index = mxFrameThis->kind;
979
6.72M
        if (index < XS_REFERENCE_KIND) {
980
2.43M
          if ((index == XS_UNDEFINED_KIND) || (index == XS_NULL_KIND)) {
981
2.39M
            mxFrameThis->kind = XS_REFERENCE_KIND;
982
2.39M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
983
2.39M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
984
2.39M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
985
2.39M
            mxFrameThis->value.reference = mxRealmGlobal(variable)->value.reference;
986
2.39M
          }
987
41.3k
          else {
988
41.3k
            mxSaveState;
989
41.3k
            fxToInstance(the, mxFrameThis);
990
41.3k
            mxRestoreState;
991
41.3k
          }
992
2.43M
        }
993
6.72M
      }
994
6.84M
      mxNextCode(2);
995
6.84M
      mxBreak;
996
6.84M
    mxCase(XS_CODE_BEGIN_STRICT)
997
1.13M
      mxFrame->flag |= XS_STRICT_FLAG;
998
1.13M
            if (mxFrameHasTarget && (mxFrameFunction->value.reference->flag & XS_CAN_CONSTRUCT_FLAG)) {
999
3
        mxSaveState;
1000
3
        fxRunConstructor(the);
1001
3
        mxRestoreState;
1002
3
      }
1003
1.13M
      mxNextCode(2);
1004
1.13M
      mxBreak;
1005
1.13M
    mxCase(XS_CODE_BEGIN_STRICT_BASE)
1006
21.1k
      mxFrame->flag |= XS_STRICT_FLAG;
1007
21.1k
      mxSaveState;
1008
21.1k
      fxRunBase(the);
1009
21.1k
      mxRestoreState;
1010
21.1k
      mxNextCode(2);
1011
21.1k
      mxBreak;
1012
21.1k
    mxCase(XS_CODE_BEGIN_STRICT_DERIVED)
1013
227
      mxFrame->flag |= XS_STRICT_FLAG;
1014
227
      mxSaveState;
1015
227
      fxRunDerived(the);
1016
227
      mxRestoreState;
1017
227
      mxNextCode(2);
1018
227
      mxBreak;
1019
19.4k
    mxCase(XS_CODE_BEGIN_STRICT_FIELD)
1020
19.4k
      mxFrame->flag |= XS_STRICT_FLAG | XS_FIELD_FLAG;
1021
19.4k
            if (mxFrameHasTarget) {
1022
0
        mxSaveState;
1023
0
        fxRunConstructor(the);
1024
0
        mxRestoreState;
1025
0
      }
1026
19.4k
      mxNextCode(2);
1027
19.4k
      mxBreak;
1028
          
1029
407k
    mxCase(XS_CODE_END_ARROW)
1030
407k
      slot = mxFrameResult;
1031
407k
      goto XS_CODE_END_ALL;
1032
2.94k
    mxCase(XS_CODE_END_BASE)
1033
2.94k
    XS_CODE_END_BASE_ALL:
1034
2.94k
      slot = mxFrameResult;
1035
2.94k
      if (slot->kind != XS_REFERENCE_KIND)
1036
2.93k
        slot = mxFrameThis;
1037
2.94k
      goto XS_CODE_END_ALL;
1038
210
    mxCase(XS_CODE_END_DERIVED)
1039
210
    XS_CODE_END_DERIVED_ALL:
1040
210
      slot = mxFrameResult;
1041
210
      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
202
      goto XS_CODE_END_ALL;
1049
3.55M
    mxCase(XS_CODE_END)
1050
3.55M
      slot = mxFrameResult;
1051
3.55M
      if (mxFrameHasTarget) {
1052
254
        if (slot->kind != XS_REFERENCE_KIND)
1053
208
          slot = mxFrameThis;
1054
254
      }
1055
150M
    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
150M
      mxStack = mxFrameEnd;
1064
150M
      mxScope = mxFrame->value.frame.scope;
1065
150M
      mxCode = mxFrame->value.frame.code;
1066
150M
      mxAllocStack(1);
1067
150M
      *mxStack = *slot;
1068
150M
      mxFrame = mxFrame->next;
1069
150M
      if (!mxFrame || (mxFrame->flag & XS_C_FLAG)) {
1070
#ifdef mxTrace
1071
        if (gxDoTrace) fxTraceReturn(the);
1072
#endif
1073
99.2M
        byte = XS_CODE_END;
1074
99.2M
        mxSaveState;
1075
99.2M
        return; 
1076
99.2M
      }
1077
50.8M
      mxEnvironment = mxFrameToEnvironment(mxFrame);
1078
50.8M
      mxFirstCode();
1079
50.8M
      mxBreak;
1080
50.8M
    mxCase(XS_CODE_RETURN)
1081
100k
      mxStack = mxFrameEnd;
1082
100k
      mxScope = mxFrame->value.frame.scope;
1083
100k
      mxCode = mxFrame->value.frame.code;
1084
100k
      mxAllocStack(1);
1085
100k
      *mxStack = *mxFrameResult;
1086
100k
      mxFrame = mxFrame->next;
1087
#ifdef mxTrace
1088
      if (gxDoTrace)
1089
        if (gxDoTrace) fxTraceReturn(the);
1090
#endif
1091
100k
      mxSaveState;
1092
100k
      return;
1093
      
1094
409k
    mxCase(XS_CODE_START_ASYNC)
1095
409k
      mxSkipCode(1);
1096
409k
      mxSaveState;
1097
409k
      variable = gxDefaults.newAsyncInstance(the);
1098
409k
      mxRestoreState;
1099
409k
      slot = mxFrameEnd;
1100
409k
      mxPushKind(XS_INTEGER_KIND);
1101
409k
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1102
409k
      mxPushKind(XS_INTEGER_KIND);
1103
409k
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1104
409k
      mxPushKind(XS_INTEGER_KIND);
1105
409k
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1106
409k
      mxPushKind(XS_INTEGER_KIND);
1107
409k
      mxStack->value.integer = 0;
1108
409k
      mxPushKind(mxFrameFunction->kind);
1109
409k
      mxStack->value = mxFrameFunction->value;
1110
409k
      index = mxPtrDiff(slot - mxStack);
1111
409k
      slot = variable->next;
1112
409k
      variable = slot->value.stack.address;
1113
409k
      if (slot->value.stack.length < index) {
1114
409k
        mxSaveState;
1115
409k
        if (variable)
1116
0
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1117
409k
        if (!variable)
1118
409k
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1119
409k
        mxRestoreState;
1120
409k
        slot->value.stack.address = variable;
1121
409k
      }
1122
409k
      slot->value.stack.length = index;
1123
409k
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1124
409k
      mxStack += 5;
1125
409k
      mxSaveState;
1126
409k
      gxDefaults.runAsync(the, mxStack->value.reference);
1127
409k
      mxRestoreState;
1128
409k
      slot = mxFrameResult;
1129
409k
      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
1.80M
    mxCase(XS_CODE_START_GENERATOR)
1173
1.80M
      mxSkipCode(1);
1174
1.80M
            if (mxFrameHasTarget)
1175
1.80M
        mxRunDebug(XS_TYPE_ERROR, "new: generator");
1176
1.80M
      slot = mxBehaviorGetProperty(the, mxFrameFunction->value.reference, mxID(_prototype), 0, XS_ANY);
1177
1.80M
      mxPushKind(slot->kind);
1178
1.80M
      mxStack->value = slot->value;
1179
1.80M
      mxSaveState;
1180
1.80M
      variable = gxDefaults.newGeneratorInstance(the);
1181
1.80M
      mxRestoreState;
1182
1.80M
      slot = mxFrameEnd;
1183
1.80M
      mxPushKind(XS_INTEGER_KIND);
1184
1.80M
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1185
1.80M
      mxPushKind(XS_INTEGER_KIND);
1186
1.80M
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1187
1.80M
      mxPushKind(XS_INTEGER_KIND);
1188
1.80M
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1189
1.80M
      mxPushKind(XS_INTEGER_KIND);
1190
1.80M
      mxStack->value.integer = 0;
1191
1.80M
      mxPushKind(mxFrameFunction->kind);
1192
1.80M
      mxStack->value = mxFrameFunction->value;
1193
1.80M
      index = mxPtrDiff(slot - mxStack);
1194
1.80M
      slot = variable->next;
1195
1.80M
      variable = slot->value.stack.address;
1196
1.80M
      if (slot->value.stack.length < index) {
1197
1.80M
        mxSaveState;
1198
1.80M
        if (variable)
1199
0
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1200
1.80M
        if (!variable)
1201
1.80M
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1202
1.80M
        mxRestoreState;
1203
1.80M
        slot->value.stack.address = variable;
1204
1.80M
      }
1205
1.80M
      slot->value.stack.length = index;
1206
1.80M
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1207
1.80M
      mxStack += 5;
1208
1.80M
      *mxFrameResult = *(mxStack++);
1209
1.80M
      slot = mxFrameResult;
1210
1.80M
      goto XS_CODE_END_ALL;
1211
      
1212
88.4k
    mxCase(XS_CODE_AWAIT)
1213
201k
    mxCase(XS_CODE_YIELD)
1214
201k
    mxCase(XS_CODE_YIELD_STAR)
1215
201k
      generator->next->next->value.integer = byte;
1216
201k
      mxSkipCode(1);
1217
201k
      slot = mxFrameEnd;
1218
201k
      mxPushKind(XS_INTEGER_KIND);
1219
201k
      mxStack->value.integer = mxPtrDiff(mxCode - mxFrameFunction->value.reference->next->value.code.address);
1220
201k
      mxPushKind(XS_INTEGER_KIND);
1221
201k
      mxStack->value.integer = mxPtrDiff(slot - mxScope);
1222
201k
      mxPushKind(XS_INTEGER_KIND);
1223
201k
      mxStack->value.integer = mxPtrDiff(slot - mxFrame);
1224
201k
      jump = the->firstJump;
1225
201k
      offset = 0;
1226
201k
      while (jump != yieldJump) {
1227
43
        txJump* nextJump = jump->nextJump;
1228
43
        mxPushKind(XS_INTEGER_KIND);
1229
43
        mxStack->value.integer = mxPtrDiff(jump->code - mxFrameFunction->value.reference->next->value.code.address);
1230
43
        mxPushKind(XS_INTEGER_KIND);
1231
43
        mxStack->value.integer = mxPtrDiff(slot - jump->scope);
1232
43
        mxPushKind(XS_INTEGER_KIND);
1233
43
        mxStack->value.integer = mxPtrDiff(slot - jump->frame);
1234
43
        mxPushKind(XS_INTEGER_KIND);
1235
43
        mxStack->value.integer = mxPtrDiff(slot - jump->stack);
1236
43
        c_free(jump);
1237
43
        jump = nextJump;
1238
43
        offset++;
1239
43
      }
1240
201k
      the->firstJump = yieldJump;
1241
201k
      mxPushKind(XS_INTEGER_KIND);
1242
201k
      mxStack->value.integer = offset;
1243
201k
      mxPushKind(mxFrameFunction->kind);
1244
201k
      mxStack->value = mxFrameFunction->value;
1245
201k
      index = mxPtrDiff(slot - mxStack);
1246
201k
      slot = generator->next;
1247
201k
      variable = slot->value.stack.address;
1248
201k
      if (slot->value.stack.length < index) {
1249
121k
        mxSaveState;
1250
121k
        if (variable)
1251
121k
          variable = (txSlot *)fxRenewChunk(the, variable, index * sizeof(txSlot));
1252
121k
        if (!variable)
1253
72.9k
          variable = (txSlot *)fxNewChunk(the, index * sizeof(txSlot));
1254
121k
        mxRestoreState;
1255
121k
        slot->value.stack.address = variable;
1256
121k
      }
1257
201k
      slot->value.stack.length = index;
1258
201k
      c_memcpy(variable, mxStack, index * sizeof(txSlot));
1259
201k
      mxStack += 5 + (offset * 4);
1260
201k
      *mxFrameResult = *(mxStack++);
1261
201k
      slot = mxFrameResult;
1262
201k
      goto XS_CODE_END_ALL;
1263
      
1264
  /* FRAMES */    
1265
5.53M
    mxCase(XS_CODE_ARGUMENT)
1266
5.53M
      offset = mxRunU1(1);
1267
#ifdef mxTrace
1268
      if (gxDoTrace) fxTraceInteger(the, offset);
1269
#endif
1270
5.53M
      if (offset < mxFrameArgc) {
1271
4.94M
        slot = mxFrameArgv(offset);
1272
4.94M
        mxPushKind(slot->kind);
1273
4.94M
        mxStack->value = slot->value;
1274
4.94M
      }
1275
591k
      else {
1276
591k
        mxPushKind(XS_UNDEFINED_KIND);
1277
591k
      }
1278
5.53M
      mxNextCode(2);
1279
5.53M
      mxBreak;
1280
5.53M
    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
397k
    mxCase(XS_CODE_ARGUMENTS_SLOPPY)
1291
397k
      offset = mxRunU1(1);
1292
397k
      mxAllocStack(1);
1293
397k
      *mxStack = mxArgumentsSloppyPrototype;
1294
397k
      mxSaveState;
1295
397k
      gxDefaults.newArgumentsSloppyInstance(the, offset);
1296
397k
      mxRestoreState;
1297
397k
      mxNextCode(2);
1298
397k
      mxBreak;
1299
397k
    mxCase(XS_CODE_ARGUMENTS_STRICT)
1300
8.50k
      offset = mxRunU1(1);
1301
8.50k
      mxAllocStack(1);
1302
8.50k
      *mxStack = mxArgumentsStrictPrototype;
1303
8.50k
      mxSaveState;
1304
8.50k
      gxDefaults.newArgumentsStrictInstance(the, offset);
1305
8.50k
      mxRestoreState;
1306
8.50k
      mxNextCode(2);
1307
8.50k
      mxBreak;
1308
151k
    mxCase(XS_CODE_CURRENT)
1309
151k
      mxAllocStack(1);
1310
151k
      *mxStack = *mxFrameFunction;
1311
151k
      if (!(mxFrame->flag & XS_STRICT_FLAG))
1312
145k
        ignore = 1;
1313
151k
      mxNextCode(1);
1314
151k
      mxBreak;
1315
151k
    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
48.2M
    mxCase(XS_CODE_SET_RESULT)
1321
48.2M
      *mxFrameResult = *(mxStack++);
1322
48.2M
      mxNextCode(1);
1323
48.2M
      mxBreak;
1324
48.2M
    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.64M
    mxCase(XS_CODE_THIS)
1335
2.64M
      mxAllocStack(1);
1336
2.64M
      *mxStack = *mxFrameThis;
1337
2.64M
      mxNextCode(1);
1338
2.64M
      mxBreak;
1339
2.64M
    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
199
    mxCase(XS_CODE_SET_THIS)
1349
199
      slot = mxFrameThis;
1350
199
      variable = slot->value.closure;
1351
199
      if (variable->kind >= 0)
1352
199
        mxRunDebug(XS_REFERENCE_ERROR, "this: already initialized");
1353
199
      variable->kind = mxStack->kind;
1354
199
      variable->value = mxStack->value;
1355
199
      mxNextCode(1);
1356
199
      mxBreak;
1357
    
1358
  /* EXCEPTIONS */  
1359
1.44M
    mxCase(XS_CODE_EXCEPTION)
1360
1.44M
      mxAllocStack(1);
1361
1.44M
      *mxStack = mxException;
1362
1.44M
      mxException = mxUndefined;
1363
1.44M
      mxNextCode(1);
1364
1.44M
      mxBreak;
1365
1.44M
    mxCase(XS_CODE_CATCH_4)
1366
34.7k
      offset = mxRunS4(1);
1367
34.7k
      mxNextCode(5);
1368
34.7k
      goto XS_CODE_CATCH;
1369
1.08M
    mxCase(XS_CODE_CATCH_2)
1370
1.08M
      offset = mxRunS2(1);
1371
1.08M
      mxNextCode(3);
1372
1.08M
      goto XS_CODE_CATCH;
1373
1.35M
    mxCase(XS_CODE_CATCH_1)
1374
1.35M
      offset = mxRunS1(1);
1375
1.35M
      mxNextCode(2);
1376
2.46M
    XS_CODE_CATCH:
1377
2.46M
      jump = c_malloc(sizeof(txJump));
1378
2.46M
      if (jump) {
1379
2.46M
        jump->nextJump = the->firstJump;
1380
2.46M
        jump->stack = mxStack;
1381
2.46M
        jump->scope = mxScope;
1382
2.46M
        jump->frame = mxFrame;
1383
2.46M
        jump->environment = mxEnvironment->value.reference;
1384
2.46M
        jump->code = mxCode + offset;
1385
2.46M
        jump->flag = 1;
1386
2.46M
                the->firstJump = jump;
1387
2.46M
        if (c_setjmp(jump->buffer) != 0) {
1388
683k
          jump = the->firstJump;
1389
683k
                    the->firstJump = jump->nextJump;
1390
683k
          mxStack = jump->stack;
1391
683k
          mxScope = jump->scope;
1392
683k
          mxFrame = jump->frame;
1393
683k
          mxEnvironment = mxFrameToEnvironment(mxFrame);
1394
683k
          mxEnvironment->value.reference = jump->environment;
1395
683k
          mxCode = jump->code;
1396
683k
          c_free(jump);
1397
683k
          mxFirstCode();
1398
683k
        }
1399
2.46M
      }
1400
0
      else {
1401
0
        mxSaveState;
1402
0
        fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
1403
0
      }
1404
2.46M
      mxBreak;
1405
2.46M
    mxCase(XS_CODE_RETHROW)
1406
0
      mxSaveState;
1407
0
      fxJump(the);
1408
0
      mxBreak;
1409
433k
    mxCase(XS_CODE_THROW)
1410
433k
      mxException = *mxStack;
1411
433k
    #ifdef mxDebug
1412
433k
      mxSaveState;
1413
433k
      fxDebugThrow(the, C_NULL, 0, "throw");
1414
433k
      mxRestoreState;
1415
    #elif mxInstrument
1416
      mxSaveState;
1417
      fxTraceException(the);
1418
      mxRestoreState;
1419
    #endif
1420
433k
      mxSaveState;
1421
433k
      fxJump(the);
1422
0
      mxBreak;
1423
16
    mxCase(XS_CODE_THROW_STATUS)
1424
16
      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
13
      mxNextCode(1);
1439
13
      mxBreak;
1440
1.76M
    mxCase(XS_CODE_UNCATCH)
1441
1.76M
      jump = the->firstJump;
1442
1.76M
      the->firstJump = jump->nextJump;
1443
1.76M
      c_free(jump);
1444
1.76M
      mxNextCode(1);
1445
1.76M
      mxBreak;
1446
      
1447
  /* BRANCHES */  
1448
26.2M
    mxCase(XS_CODE_BRANCH_1)
1449
26.2M
      offset = mxRunS1(1);
1450
26.2M
      mxBranch(2, offset);
1451
26.2M
      mxBreak;
1452
26.2M
    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
277k
      offset = mxRunS4(1);
1458
277k
      mxBranch(5, offset);
1459
277k
      mxBreak;
1460
277k
    mxCase(XS_CODE_BRANCH_CHAIN_4)
1461
1
      offset = mxRunS4(1);
1462
1
      index = 5;
1463
1
      goto XS_CODE_BRANCH_CHAIN;
1464
2.87k
    mxCase(XS_CODE_BRANCH_CHAIN_2)
1465
2.87k
      offset = mxRunS2(1);
1466
2.87k
      index = 3;
1467
2.87k
      goto XS_CODE_BRANCH_CHAIN;
1468
24.3k
    mxCase(XS_CODE_BRANCH_CHAIN_1)
1469
24.3k
      offset = mxRunS1(1);
1470
24.3k
      index = 2;
1471
27.2k
    XS_CODE_BRANCH_CHAIN:
1472
27.2k
      byte = mxStack->kind;
1473
27.2k
      if ((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte)) {
1474
19.6k
        mxStack->kind = XS_UNDEFINED_KIND;
1475
19.6k
        mxBranch(index, offset);
1476
19.6k
      }
1477
7.55k
      else
1478
7.55k
        mxNextCode((txS4)index);
1479
27.2k
      mxBreak;
1480
90.6k
    mxCase(XS_CODE_BRANCH_COALESCE_4)
1481
90.6k
      offset = mxRunS4(1);
1482
90.6k
      index = 5;
1483
90.6k
      goto XS_CODE_BRANCH_COALESCE;
1484
3.45M
    mxCase(XS_CODE_BRANCH_COALESCE_2)
1485
3.45M
      offset = mxRunS2(1);
1486
3.45M
      index = 3;
1487
3.45M
      goto XS_CODE_BRANCH_COALESCE;
1488
723k
    mxCase(XS_CODE_BRANCH_COALESCE_1)
1489
723k
      offset = mxRunS1(1);
1490
723k
      index = 2;
1491
4.26M
    XS_CODE_BRANCH_COALESCE:
1492
4.26M
      byte = mxStack->kind;
1493
4.26M
      if ((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte)) {
1494
3.45k
        mxStack++;
1495
3.45k
        mxNextCode((txS4)index);
1496
3.45k
      }
1497
4.26M
      else {
1498
4.26M
        mxBranch(index, offset);
1499
4.26M
      }
1500
4.26M
      mxBreak;
1501
4.26M
    mxCase(XS_CODE_BRANCH_ELSE_4)
1502
182k
      offset = mxRunS4(1);
1503
182k
      index = 5;
1504
182k
      goto XS_CODE_BRANCH_ELSE;
1505
9.68M
    mxCase(XS_CODE_BRANCH_ELSE_2)
1506
9.68M
      offset = mxRunS2(1);
1507
9.68M
      index = 3;
1508
9.68M
      goto XS_CODE_BRANCH_ELSE;
1509
26.8M
    mxCase(XS_CODE_BRANCH_ELSE_1)
1510
26.8M
      offset = mxRunS1(1);
1511
26.8M
      index = 2;
1512
36.6M
    XS_CODE_BRANCH_ELSE:
1513
36.6M
      byte = mxStack->kind;
1514
36.6M
      if (XS_BOOLEAN_KIND == byte) {
1515
16.4M
        mxBranchElse(mxStack->value.boolean, index, offset);
1516
16.4M
      }
1517
20.1M
      else if (XS_INTEGER_KIND == byte) {
1518
14.1M
        mxBranchElse(mxStack->value.integer, index, offset);
1519
14.1M
      }
1520
6.00M
      else if (XS_NUMBER_KIND == byte) {
1521
2.34M
        mxBranchIf((c_isnan(mxStack->value.number) || c_iszero(mxStack->value.number)), index, offset);
1522
2.34M
        mxFloatingPointOp("else");
1523
2.34M
      }
1524
3.65M
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte)) {
1525
953k
        mxBranchIf(((mxStack->value.bigint.size == 1) && (mxStack->value.bigint.data[0] == 0)), index, offset);
1526
953k
      }
1527
2.70M
      else if ((XS_STRING_KIND == byte) || (XS_STRING_X_KIND == byte)) {
1528
989k
        mxBranchIf(c_isEmpty(mxStack->value.string), index, offset);
1529
989k
      }
1530
1.71M
      else {
1531
1.71M
        mxBranchIf((XS_UNDEFINED_KIND == byte) || (XS_NULL_KIND == byte), index, offset);
1532
1.71M
      }
1533
36.6M
      mxStack++;
1534
36.6M
      mxBreak;
1535
36.6M
    mxCase(XS_CODE_BRANCH_IF_4)
1536
94.2k
      offset = mxRunS4(1);
1537
94.2k
      index = 5;
1538
94.2k
      goto XS_CODE_BRANCH_IF;
1539
7.95M
    mxCase(XS_CODE_BRANCH_IF_2)
1540
7.95M
      offset = mxRunS2(1);
1541
7.95M
      index = 3;
1542
7.95M
      goto XS_CODE_BRANCH_IF;
1543
7.93M
    mxCase(XS_CODE_BRANCH_IF_1)
1544
7.93M
      offset = mxRunS1(1);
1545
7.93M
      index = 2;
1546
15.9M
    XS_CODE_BRANCH_IF:
1547
15.9M
      byte = mxStack->kind;
1548
15.9M
      if (XS_BOOLEAN_KIND == byte) {
1549
10.0M
        mxBranchIf(mxStack->value.boolean, index, offset);
1550
10.0M
      }
1551
5.97M
      else if (XS_INTEGER_KIND == byte) {
1552
4.28M
        mxBranchIf(mxStack->value.integer, index, offset);
1553
4.28M
      }
1554
1.68M
      else if (XS_NUMBER_KIND == byte) {
1555
721k
        mxBranchElse(c_isnan(mxStack->value.number) || c_iszero(mxStack->value.number), index, offset);
1556
721k
        mxFloatingPointOp("if");
1557
721k
      }
1558
967k
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte)) {
1559
2.52k
        mxBranchElse((mxStack->value.bigint.size == 1) && (mxStack->value.bigint.data[0] == 0), index, offset);
1560
2.52k
      }
1561
964k
      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
15.9M
      mxStack++;
1568
15.9M
      mxBreak;
1569
15.9M
    mxCase(XS_CODE_BRANCH_STATUS_4)
1570
0
      offset = mxRunS4(1);
1571
0
      index = 5;
1572
0
      goto XS_CODE_BRANCH_STATUS;
1573
16.9k
    mxCase(XS_CODE_BRANCH_STATUS_2)
1574
16.9k
      offset = mxRunS2(1);
1575
16.9k
      index = 3;
1576
16.9k
      goto XS_CODE_BRANCH_STATUS;
1577
140k
    mxCase(XS_CODE_BRANCH_STATUS_1)
1578
140k
      offset = mxRunS1(1);
1579
140k
      index = 2;
1580
157k
    XS_CODE_BRANCH_STATUS:
1581
157k
      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
157k
      mxNextCode((the->status & XS_RETURN_STATUS) ? index : index + offset);
1596
157k
      mxBreak;
1597
      
1598
  /* STACK */  
1599
59.1M
    mxCase(XS_CODE_DUB)
1600
59.1M
      mxAllocStack(1);
1601
59.1M
      *mxStack = *(mxStack + 1);
1602
59.1M
      mxNextCode(1);
1603
59.1M
      mxBreak;
1604
59.1M
    mxCase(XS_CODE_DUB_AT)
1605
2.80M
      mxAllocStack(2);
1606
2.80M
      *(mxStack + 1) = *(mxStack + 3);
1607
2.80M
      *mxStack = *(mxStack + 2);
1608
2.80M
      mxNextCode(1);
1609
2.80M
      mxBreak;
1610
83.3M
    mxCase(XS_CODE_POP)
1611
83.3M
      mxStack++;
1612
83.3M
      mxNextCode(1);
1613
83.3M
      mxBreak;
1614
83.3M
    mxCase(XS_CODE_SWAP)
1615
4.57k
      scratch = *(mxStack);
1616
4.57k
      *(mxStack) = *(mxStack + 1);
1617
4.57k
      *(mxStack + 1) = scratch;
1618
4.57k
      mxNextCode(1);
1619
4.57k
      mxBreak;
1620
1621
  /* SCOPE */    
1622
4.57k
    mxCase(XS_CODE_CONST_CLOSURE_2)
1623
0
      index = mxRunU2(1);
1624
0
      mxNextCode(3);
1625
0
      goto XS_CODE_CONST_CLOSURE;
1626
199k
    mxCase(XS_CODE_CONST_CLOSURE_1)
1627
199k
      index = mxRunU1(1);
1628
199k
      mxNextCode(2);
1629
199k
    XS_CODE_CONST_CLOSURE:
1630
#ifdef mxTrace
1631
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1632
#endif
1633
199k
      slot = mxEnvironment - index;
1634
199k
      variable = slot->value.closure;
1635
199k
      if (variable->kind >= 0)
1636
195k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: already initialized", slot->ID);
1637
//      slot->flag |= XS_DONT_SET_FLAG; //@@
1638
195k
      variable->flag |= XS_DONT_SET_FLAG;
1639
195k
      variable->kind = mxStack->kind;
1640
195k
      variable->value = mxStack->value;
1641
195k
      if (!(mxFrame->flag & XS_STRICT_FLAG) && ignore) {
1642
17.4k
        ignore = 0;
1643
17.4k
        variable->flag |= XS_DONT_ENUM_FLAG;
1644
17.4k
      }
1645
195k
      mxBreak;
1646
233k
    mxCase(XS_CODE_CONST_LOCAL_2)
1647
233k
      index = mxRunU2(1);
1648
233k
      mxNextCode(3);
1649
233k
      goto XS_CODE_CONST_LOCAL;
1650
3.71M
    mxCase(XS_CODE_CONST_LOCAL_1)
1651
3.71M
      index = mxRunU1(1);
1652
3.71M
      mxNextCode(2);
1653
3.94M
    XS_CODE_CONST_LOCAL:
1654
#ifdef mxTrace
1655
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1656
#endif
1657
3.94M
      variable = mxEnvironment - index;
1658
3.94M
      if (variable->kind >= 0)
1659
3.94M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: already initialized", variable->ID);
1660
3.94M
      variable->flag |= XS_DONT_SET_FLAG;
1661
3.94M
      variable->kind = mxStack->kind;
1662
3.94M
      variable->value = mxStack->value;
1663
3.94M
      if (!(mxFrame->flag & XS_STRICT_FLAG) && ignore) {
1664
121k
        ignore = 0;
1665
121k
        variable->flag |= XS_DONT_ENUM_FLAG;
1666
121k
      }
1667
3.94M
      mxBreak;
1668
            
1669
3.94M
    mxCase(XS_CODE_GET_CLOSURE_2)
1670
0
      index = mxRunU2(1);
1671
0
      mxNextCode(3);
1672
0
      goto XS_CODE_GET_CLOSURE;
1673
6.61M
    mxCase(XS_CODE_GET_CLOSURE_1)
1674
6.61M
      index = mxRunU1(1);
1675
6.61M
      mxNextCode(2);
1676
6.61M
    XS_CODE_GET_CLOSURE:
1677
#ifdef mxTrace
1678
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1679
#endif
1680
6.61M
      slot = mxEnvironment - index;
1681
6.61M
      #ifdef mxDebug
1682
6.61M
        offset = slot->ID;
1683
6.61M
      #endif
1684
6.61M
      variable = slot->value.closure;
1685
6.61M
      if (variable->kind < 0)
1686
6.57M
        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
6.57M
      mxPushKind(variable->kind);
1696
6.57M
      mxStack->value = variable->value;
1697
6.57M
      mxBreak;
1698
6.57M
    mxCase(XS_CODE_GET_LOCAL_2)
1699
709k
      index = mxRunU2(1);
1700
709k
      mxNextCode(3);
1701
709k
      goto XS_CODE_GET_LOCAL;
1702
62.6M
    mxCase(XS_CODE_GET_LOCAL_1)
1703
62.6M
      index = mxRunU1(1);
1704
62.6M
      mxNextCode(2);
1705
63.4M
    XS_CODE_GET_LOCAL:
1706
#ifdef mxTrace
1707
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1708
#endif
1709
63.4M
      variable = mxEnvironment - index;
1710
63.4M
      #ifdef mxDebug
1711
63.4M
        offset = variable->ID;
1712
63.4M
      #endif
1713
63.4M
      if (variable->kind < 0)
1714
63.3M
        mxRunDebugID(XS_REFERENCE_ERROR, "get %s: not initialized yet", variable->ID);
1715
63.3M
      mxPushKind(variable->kind);
1716
63.3M
      mxStack->value = variable->value;
1717
63.3M
      mxBreak;
1718
      
1719
63.3M
    mxCase(XS_CODE_LET_CLOSURE_2)
1720
0
      index = mxRunU2(1);
1721
0
      mxNextCode(3);
1722
0
      goto XS_CODE_LET_CLOSURE;
1723
154k
    mxCase(XS_CODE_LET_CLOSURE_1)
1724
154k
      index = mxRunU1(1);
1725
154k
      mxNextCode(2);
1726
154k
    XS_CODE_LET_CLOSURE:
1727
#ifdef mxTrace
1728
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1729
#endif
1730
154k
      slot = mxEnvironment - index;
1731
154k
      variable = slot->value.closure;
1732
154k
      variable->kind = mxStack->kind;
1733
154k
      variable->value = mxStack->value;
1734
154k
      mxBreak;
1735
154k
    mxCase(XS_CODE_LET_LOCAL_2)
1736
0
      index = mxRunU2(1);
1737
0
      mxNextCode(3);
1738
0
      goto XS_CODE_LET_LOCAL;
1739
1.15M
    mxCase(XS_CODE_LET_LOCAL_1)
1740
1.15M
      index = mxRunU1(1);
1741
1.15M
      mxNextCode(2);
1742
1.15M
    XS_CODE_LET_LOCAL:
1743
#ifdef mxTrace
1744
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1745
#endif
1746
1.15M
      variable = mxEnvironment - index;
1747
1.15M
      variable->kind = mxStack->kind;
1748
1.15M
      variable->value = mxStack->value;
1749
1.15M
      mxBreak;
1750
      
1751
1.26M
    mxCase(XS_CODE_NEW_CLOSURE)
1752
1.26M
      offset = mxRunID(1);
1753
#ifdef mxTrace
1754
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
1755
#endif
1756
1.26M
      mxNextCode(1 + sizeof(txID));
1757
1.26M
      slot = --mxScope;
1758
#ifdef mxTrace
1759
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1760
#endif
1761
1.26M
      mxSaveState;
1762
1.26M
      variable = fxNewSlot(the);
1763
1.26M
      mxRestoreState;
1764
1.26M
      slot->flag = XS_DONT_DELETE_FLAG;
1765
1.26M
      slot->ID = (txID)offset;
1766
1.26M
      slot->kind = XS_CLOSURE_KIND;
1767
1.26M
      slot->value.closure = variable;
1768
1.26M
      variable->kind = XS_UNINITIALIZED_KIND;
1769
1.26M
      mxBreak;
1770
11.3M
    mxCase(XS_CODE_NEW_LOCAL)
1771
11.3M
      offset = mxRunID(1);
1772
#ifdef mxTrace
1773
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
1774
#endif
1775
11.3M
      mxNextCode(1 + sizeof(txID));
1776
11.3M
      variable = --mxScope;
1777
#ifdef mxTrace
1778
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1779
#endif
1780
11.3M
      variable->flag = XS_DONT_DELETE_FLAG;
1781
11.3M
      variable->ID = (txID)offset;
1782
11.3M
      variable->kind = XS_UNINITIALIZED_KIND;
1783
11.3M
      mxBreak;
1784
34.3M
    mxCase(XS_CODE_NEW_TEMPORARY)
1785
34.3M
      variable = --mxScope;
1786
#ifdef mxTrace
1787
      if (gxDoTrace) fxTraceIndex(the, mxEnvironment - mxScope - 1);
1788
#endif
1789
34.3M
      mxInitSlotKind(variable, XS_UNDEFINED_KIND);
1790
34.3M
      mxNextCode(1);
1791
34.3M
      mxBreak;
1792
      
1793
34.3M
    mxCase(XS_CODE_PULL_CLOSURE_2)
1794
0
      index = mxRunU2(1);
1795
0
      mxNextCode(3);
1796
0
      goto XS_CODE_PULL_CLOSURE;
1797
718k
    mxCase(XS_CODE_PULL_CLOSURE_1)
1798
718k
      index = mxRunU1(1);
1799
718k
      mxNextCode(2);
1800
718k
    XS_CODE_PULL_CLOSURE:
1801
#ifdef mxTrace
1802
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1803
#endif
1804
718k
      slot = mxEnvironment - index;
1805
718k
      if (slot->flag & XS_DONT_SET_FLAG) // import
1806
718k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1807
718k
      variable = slot->value.closure;
1808
718k
      if (variable->kind < 0)
1809
718k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", slot->ID);
1810
718k
      if (variable->flag & XS_DONT_SET_FLAG) {
1811
17.4k
        if (variable->flag & XS_DONT_ENUM_FLAG) {
1812
17.4k
          mxStack++;
1813
17.4k
          mxBreak;
1814
17.4k
        }
1815
17.4k
        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
700k
      variable->kind = mxStack->kind;
1830
700k
      variable->value = mxStack->value;
1831
700k
      mxStack++;
1832
700k
      mxBreak;
1833
706k
    mxCase(XS_CODE_PULL_LOCAL_2)
1834
706k
      index = mxRunU2(1);
1835
706k
      mxNextCode(3);
1836
706k
      goto XS_CODE_PULL_LOCAL;
1837
24.4M
    mxCase(XS_CODE_PULL_LOCAL_1)
1838
24.4M
      index = mxRunU1(1);
1839
24.4M
      mxNextCode(2);
1840
25.1M
    XS_CODE_PULL_LOCAL:
1841
#ifdef mxTrace
1842
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1843
#endif
1844
25.1M
      variable = mxEnvironment - index;
1845
25.1M
      if (variable->kind < 0)
1846
25.1M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", variable->ID);
1847
25.1M
      if (variable->flag & XS_DONT_SET_FLAG) {
1848
1.65k
        if (variable->flag & XS_DONT_ENUM_FLAG) {
1849
1.65k
          mxStack++;
1850
1.65k
          mxBreak;
1851
1.65k
        }
1852
1.65k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", variable->ID);
1853
0
      }
1854
25.1M
      variable->kind = mxStack->kind;
1855
25.1M
      variable->value = mxStack->value;
1856
25.1M
      mxStack++;
1857
25.1M
      mxBreak;
1858
      
1859
25.1M
    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.79M
    mxCase(XS_CODE_REFRESH_LOCAL_1)
1884
1.79M
      index = mxRunU1(1);
1885
1.79M
      mxNextCode(2);
1886
1.79M
    XS_CODE_REFRESH_LOCAL:
1887
#ifdef mxTrace
1888
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1889
#endif
1890
1.79M
      variable = mxEnvironment - index;
1891
1.79M
      mxBreak;
1892
      
1893
1.79M
    mxCase(XS_CODE_RESERVE_2)
1894
6.49k
      index = mxRunU2(1);
1895
6.49k
      mxNextCode(3);
1896
6.49k
      goto XS_CODE_RESERVE;
1897
6.34M
    mxCase(XS_CODE_RESERVE_1)
1898
6.34M
      index = mxRunU1(1);
1899
6.34M
      mxNextCode(2);
1900
6.34M
    XS_CODE_RESERVE:
1901
#ifdef mxTrace
1902
      if (gxDoTrace) fxTraceIndex(the, index);
1903
#endif
1904
6.34M
      mxAllocStack(index);    
1905
6.34M
      c_memset(mxStack, 0, index * sizeof(txSlot));
1906
6.34M
      mxBreak;
1907
      
1908
6.34M
    mxCase(XS_CODE_RESET_CLOSURE_2)
1909
0
      index = mxRunU2(1);
1910
0
      mxNextCode(3);
1911
0
      goto XS_CODE_RESET_CLOSURE;
1912
679
    mxCase(XS_CODE_RESET_CLOSURE_1)
1913
679
      index = mxRunU1(1);
1914
679
      mxNextCode(2);
1915
679
    XS_CODE_RESET_CLOSURE:
1916
#ifdef mxTrace
1917
      if (gxDoTrace) fxTraceIndex(the, index);
1918
#endif
1919
679
      slot = mxEnvironment - index;
1920
679
      mxSaveState;
1921
679
      variable = fxNewSlot(the);
1922
679
      mxRestoreState;
1923
679
      variable->kind = XS_UNINITIALIZED_KIND;
1924
679
      slot->value.closure = variable;
1925
679
      mxBreak;
1926
233k
    mxCase(XS_CODE_RESET_LOCAL_2)
1927
233k
      index = mxRunU2(1);
1928
233k
      mxNextCode(3);
1929
233k
      goto XS_CODE_RESET_LOCAL;
1930
1.24M
    mxCase(XS_CODE_RESET_LOCAL_1)
1931
1.24M
      index = mxRunU1(1);
1932
1.24M
      mxNextCode(2);
1933
1.48M
    XS_CODE_RESET_LOCAL:
1934
#ifdef mxTrace
1935
      if (gxDoTrace) fxTraceIndex(the, index);
1936
#endif
1937
1.48M
      variable = mxEnvironment - index;
1938
1.48M
      variable->flag = XS_NO_FLAG;
1939
1.48M
      variable->kind = XS_UNINITIALIZED_KIND;
1940
1.48M
      mxBreak;
1941
      
1942
1.48M
    mxCase(XS_CODE_SET_CLOSURE_2)
1943
0
      index = mxRunU2(1);
1944
0
      mxNextCode(3);
1945
0
      goto XS_CODE_SET_CLOSURE;
1946
726k
    mxCase(XS_CODE_SET_CLOSURE_1)
1947
726k
      index = mxRunU1(1);
1948
726k
      mxNextCode(2);
1949
726k
    XS_CODE_SET_CLOSURE:
1950
#ifdef mxTrace
1951
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1952
#endif
1953
726k
      slot = mxEnvironment - index;
1954
726k
      if (slot->flag & XS_DONT_SET_FLAG) // import
1955
726k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", slot->ID);
1956
726k
      variable = slot->value.closure;
1957
726k
      if (variable->kind < 0)
1958
726k
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", slot->ID);
1959
726k
      if (variable->flag & XS_DONT_SET_FLAG) {
1960
18.2k
        if (variable->flag & XS_DONT_ENUM_FLAG)
1961
17.4k
          mxBreak;
1962
18.2k
        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
707k
      variable->kind = mxStack->kind;
1977
707k
      variable->value = mxStack->value;
1978
707k
      mxBreak;
1979
707k
    mxCase(XS_CODE_SET_LOCAL_2)
1980
471k
      index = mxRunU2(1);
1981
471k
      mxNextCode(3);
1982
471k
      goto XS_CODE_SET_LOCAL;
1983
34.9M
    mxCase(XS_CODE_SET_LOCAL_1)
1984
34.9M
      index = mxRunU1(1);
1985
34.9M
      mxNextCode(2);
1986
35.4M
    XS_CODE_SET_LOCAL:
1987
#ifdef mxTrace
1988
      if (gxDoTrace) fxTraceIndex(the, index - 1);
1989
#endif
1990
35.4M
      variable = mxEnvironment - index;
1991
35.4M
      if (variable->kind < 0)
1992
35.4M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", variable->ID);
1993
35.4M
      if (variable->flag & XS_DONT_SET_FLAG) {
1994
66.7k
        if (variable->flag & XS_DONT_ENUM_FLAG)
1995
65.9k
          mxBreak;
1996
66.7k
        mxRunDebugID(XS_TYPE_ERROR, "set %s: const", variable->ID);
1997
0
      }
1998
35.3M
      variable->kind = mxStack->kind;
1999
35.3M
      variable->value = mxStack->value;
2000
35.3M
      mxBreak;
2001
2002
35.3M
    mxCase(XS_CODE_VAR_CLOSURE_2)
2003
150
      index = mxRunU2(1);
2004
150
      mxNextCode(3);
2005
150
      goto XS_CODE_VAR_CLOSURE;
2006
1.07M
    mxCase(XS_CODE_VAR_CLOSURE_1)
2007
1.07M
      index = mxRunU1(1);
2008
1.07M
      mxNextCode(2);
2009
1.07M
    XS_CODE_VAR_CLOSURE:
2010
#ifdef mxTrace
2011
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2012
#endif
2013
1.07M
      variable = (mxEnvironment - index)->value.closure;
2014
1.07M
      variable->kind = mxStack->kind;
2015
1.07M
      variable->value = mxStack->value;
2016
1.07M
      mxBreak;
2017
1.07M
    mxCase(XS_CODE_VAR_LOCAL_2)
2018
0
      index = mxRunU2(1);
2019
0
      mxNextCode(3);
2020
0
      goto XS_CODE_VAR_LOCAL;
2021
8.01M
    mxCase(XS_CODE_VAR_LOCAL_1)
2022
8.01M
      index = mxRunU1(1);
2023
8.01M
      mxNextCode(2);
2024
8.01M
    XS_CODE_VAR_LOCAL:
2025
#ifdef mxTrace
2026
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2027
#endif
2028
8.01M
      variable = mxEnvironment - index;
2029
8.01M
      variable->kind = mxStack->kind;
2030
8.01M
      variable->value = mxStack->value;
2031
8.01M
      mxBreak;
2032
      
2033
8.01M
    mxCase(XS_CODE_UNWIND_2)
2034
0
      index = mxRunU2(1);
2035
0
      mxNextCode(3);
2036
0
      goto XS_CODE_UNWIND;
2037
20.5M
    mxCase(XS_CODE_UNWIND_1)
2038
20.5M
      index = mxRunU1(1);
2039
20.5M
      mxNextCode(2);
2040
20.5M
    XS_CODE_UNWIND:
2041
#ifdef mxTrace
2042
      if (gxDoTrace) fxTraceIndex(the, index);
2043
#endif
2044
20.5M
      slot = mxScope;
2045
20.5M
      mxScope += index;
2046
50.1M
      while (slot < mxScope)
2047
29.6M
        (slot++)->kind = XS_UNDEFINED_KIND;
2048
20.5M
      mxBreak;
2049
      
2050
20.5M
    mxCase(XS_CODE_RETRIEVE_2)
2051
0
      index = mxRunU2(1);
2052
0
      mxNextCode(3);
2053
0
      goto XS_CODE_RETRIEVE;
2054
2.37M
    mxCase(XS_CODE_RETRIEVE_1)
2055
2.37M
      index = mxRunU1(1);
2056
2.37M
      mxNextCode(2);
2057
2.37M
    XS_CODE_RETRIEVE:
2058
#ifdef mxTrace
2059
      if (gxDoTrace) fxTraceIndex(the, index);
2060
#endif
2061
2.37M
      slot = mxEnvironment->value.reference->next->next;
2062
2.37M
      variable = mxScope;
2063
5.37M
      while (index) {
2064
2.99M
        --variable;
2065
2.99M
        offset = variable->ID = slot->ID;
2066
2.99M
                variable->flag = slot->flag;
2067
2.99M
                variable->kind = slot->kind;
2068
2.99M
        variable->value = slot->value;
2069
#ifdef mxTrace
2070
        if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2071
#endif
2072
2.99M
        index--;
2073
2.99M
        slot = slot->next;
2074
2.99M
      }
2075
2.37M
      mxScope = variable;
2076
2.37M
      mxBreak;
2077
2.37M
    mxCase(XS_CODE_RETRIEVE_TARGET)
2078
426k
      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
426k
      mxNextCode(1);
2094
426k
      mxBreak;
2095
426k
    mxCase(XS_CODE_RETRIEVE_THIS)
2096
426k
      variable = mxFrameThis;
2097
426k
      variable->kind = slot->kind;
2098
426k
      variable->value = slot->value;
2099
426k
      slot = slot->next;
2100
426k
      mxNextCode(1);
2101
426k
      mxBreak;
2102
      
2103
983k
    mxCase(XS_CODE_ENVIRONMENT) 
2104
983k
      mxPushKind(XS_UNDEFINED_KIND);
2105
983k
      mxSaveState;
2106
983k
      slot = fxNewEnvironmentInstance(the, C_NULL);
2107
983k
      mxRestoreState;
2108
983k
      variable = mxFunctionInstanceCode((mxStack + 1)->value.reference);
2109
983k
      variable->value.code.closures = slot;
2110
983k
      mxNextCode(1);
2111
983k
      mxBreak;
2112
2113
983k
    mxCase(XS_CODE_STORE_2)
2114
150
      index = mxRunU2(1);
2115
150
      mxNextCode(3);
2116
150
      goto XS_CODE_STORE;
2117
1.86M
    mxCase(XS_CODE_STORE_1)
2118
1.86M
      index = mxRunU1(1);
2119
1.86M
      mxNextCode(2);
2120
1.86M
    XS_CODE_STORE:
2121
#ifdef mxTrace
2122
      if (gxDoTrace) fxTraceIndex(the, index - 1);
2123
#endif
2124
1.86M
      address = &(mxStack->value.reference->next);
2125
5.25M
      while ((slot = *address)) {
2126
3.39M
        address = &slot->next;
2127
3.39M
      }
2128
1.86M
      mxSaveState;
2129
1.86M
      *address = slot = fxNewSlot(the);
2130
1.86M
      mxRestoreState;
2131
1.86M
      variable = mxEnvironment - index;
2132
1.86M
      offset = slot->ID = variable->ID;
2133
1.86M
            slot->flag = variable->flag;
2134
1.86M
            slot->kind = variable->kind;
2135
1.86M
      slot->value = variable->value;
2136
#ifdef mxTrace
2137
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2138
#endif
2139
1.86M
      mxBreak;
2140
1.86M
    mxCase(XS_CODE_STORE_ARROW)
2141
      // super
2142
471k
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2143
471k
      slot = mxFunctionInstanceHome((mxStack + 1)->value.reference);
2144
471k
      slot->value.home.object = variable->value.home.object;
2145
      // target
2146
471k
      address = &(mxStack->value.reference->next);
2147
942k
      while ((slot = *address)) {
2148
471k
        address = &slot->next;
2149
471k
      }
2150
471k
      if (mxFrameHasTarget) {
2151
3
        mxSaveState;
2152
3
        *address = slot = fxNewSlot(the);
2153
3
        mxRestoreState;
2154
3
        slot->ID = mxID(_new_target);
2155
3
        variable = mxFrameTarget;
2156
3
        slot->kind = variable->kind;
2157
3
        slot->value = variable->value;
2158
3
        address = &slot->next;
2159
3
      }
2160
      // this
2161
471k
      mxSaveState;
2162
471k
      *address = slot = fxNewSlot(the);
2163
471k
      mxRestoreState;
2164
471k
      variable = mxFrameThis;
2165
471k
      slot->ID = mxID(_this);
2166
471k
      slot->kind = variable->kind;
2167
471k
      slot->value = variable->value;
2168
471k
      mxNextCode(1);
2169
471k
      mxBreak;
2170
      
2171
471k
    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
8.27M
    mxCase(XS_CODE_CHECK_INSTANCE)
2199
8.27M
      if (mxStack->kind != XS_REFERENCE_KIND)
2200
8.27M
        mxRunDebug(XS_TYPE_ERROR, "iterator result: not an object");
2201
8.27M
      mxNextCode(1);
2202
8.27M
      mxBreak;
2203
8.27M
    mxCase(XS_CODE_TO_INSTANCE)
2204
92.4k
      mxToInstance(mxStack);
2205
92.4k
      mxNextCode(1);
2206
92.4k
      mxBreak;
2207
      
2208
92.4k
    mxCase(XS_CODE_SUPER_AT_2)
2209
0
      slot = mxStack + 2;
2210
0
      goto XS_CODE_SUPER_AT_ALL;
2211
45
    mxCase(XS_CODE_SUPER_AT)
2212
45
      slot = mxStack + 1;
2213
      /* continue */
2214
45
    XS_CODE_SUPER_AT_ALL:
2215
45
      mxToInstance(slot);
2216
45
      slot->value.super.reference = variable;
2217
45
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference);
2218
45
      if (!variable->value.home.object) 
2219
45
        mxRunDebugID(XS_TYPE_ERROR, "super.%s: no home", (txID)offset);
2220
45
      variable = fxGetPrototype(the, variable->value.home.object);
2221
45
      if (!variable)
2222
45
        mxRunDebugID(XS_TYPE_ERROR, "super.%s: no prototype", (txID)offset);
2223
45
      slot->value.super.prototype = variable;
2224
45
      slot--;
2225
45
      goto XS_CODE_AT_ALL;
2226
299k
    mxCase(XS_CODE_AT_2)
2227
299k
      mxToInstance(mxStack + 2);
2228
299k
      slot = mxStack + 1;
2229
299k
      goto XS_CODE_AT_ALL;
2230
17.4M
    mxCase(XS_CODE_AT)
2231
17.4M
      mxToInstance(mxStack + 1);
2232
17.4M
      slot = mxStack;
2233
      /* continue */
2234
17.7M
    XS_CODE_AT_ALL:
2235
17.7M
      if (slot->kind == XS_REFERENCE_KIND) {
2236
3.69k
        mxSaveState;
2237
3.69k
        fxToPrimitive(the, slot, XS_STRING_HINT);
2238
3.69k
        mxRestoreState;
2239
3.69k
      }
2240
17.7M
      if ((slot->kind == XS_INTEGER_KIND) && fxIntegerToIndex(the, slot->value.integer, &(scratch.value.at.index))) {
2241
12.8M
        slot->kind = XS_AT_KIND;
2242
12.8M
        slot->value.at.id = XS_NO_ID;
2243
12.8M
        slot->value.at.index = scratch.value.at.index;
2244
12.8M
      }
2245
4.90M
      else if ((slot->kind == XS_NUMBER_KIND) && fxNumberToIndex(the, slot->value.number, &(scratch.value.at.index))) {
2246
527k
        slot->kind = XS_AT_KIND;
2247
527k
        slot->value.at.id = XS_NO_ID;
2248
527k
        slot->value.at.index = scratch.value.at.index;
2249
527k
      }
2250
4.37M
      else if (slot->kind == XS_SYMBOL_KIND) {
2251
215k
        slot->kind = XS_AT_KIND;
2252
215k
        slot->value.at.id = slot->value.symbol;
2253
215k
        slot->value.at.index = 0;
2254
215k
      }
2255
4.16M
      else {
2256
4.16M
        txFlag flag;
2257
2258
4.16M
        mxToString(slot);
2259
4.16M
        mxSaveState;
2260
4.16M
        flag = fxStringToIndex(the, slot->value.string, &(scratch.value.at.index));
2261
4.16M
        mxRestoreState;
2262
4.16M
        if (flag) {
2263
87.4k
#ifdef mxMetering
2264
87.4k
          the->meterIndex += 2 * XS_CODE_METERING;
2265
87.4k
#endif
2266
87.4k
          slot->kind = XS_AT_KIND;
2267
87.4k
          slot->value.at.id = XS_NO_ID;
2268
87.4k
          slot->value.at.index = scratch.value.at.index;
2269
87.4k
        }
2270
4.07M
        else {
2271
4.07M
          txID id;
2272
4.07M
          mxSaveState;
2273
4.07M
          if (slot->kind == XS_STRING_X_KIND)
2274
0
            id = fxNewNameX(the, slot->value.string);
2275
4.07M
          else
2276
4.07M
            id = fxNewName(the, slot);
2277
4.07M
          mxRestoreState;
2278
4.07M
          slot->kind = XS_AT_KIND;
2279
4.07M
          slot->value.at.id = id;
2280
4.07M
          slot->value.at.index = 0;
2281
4.07M
        }
2282
4.16M
      }
2283
17.7M
      mxNextCode(1);
2284
17.7M
      mxBreak;
2285
2286
17.7M
    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
271k
    mxCase(XS_CODE_DELETE_PROPERTY_AT)
2304
271k
      variable = (mxStack + 1)->value.reference;
2305
271k
      offset = mxStack->value.at.id;
2306
271k
      index = mxStack->value.at.index;
2307
271k
      the->stack = mxStack;
2308
271k
      mxStack++;
2309
271k
      mxNextCode(1);
2310
271k
      goto XS_CODE_DELETE_PROPERTY_ALL;
2311
477k
    mxCase(XS_CODE_DELETE_PROPERTY)
2312
477k
      mxToInstance(mxStack);
2313
477k
      offset = mxRunID(1);
2314
477k
      index = 0;
2315
477k
      the->stack = mxStack;
2316
477k
      mxNextCode(1 + sizeof(txID));
2317
      /* continue */
2318
749k
    XS_CODE_DELETE_PROPERTY_ALL:  
2319
#ifdef mxTrace
2320
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2321
#endif
2322
749k
      mxSaveStateKeepStack;
2323
749k
      index = (txU4)fxRunDelete(the, variable, (txID)offset, index);
2324
749k
      mxRestoreStateKeepStack;
2325
749k
      if (!index && (mxFrame->flag & XS_STRICT_FLAG))
2326
749k
        mxRunDebugID(XS_TYPE_ERROR, "delete %s: no permission (strict mode)", (txID)offset);
2327
749k
      mxStack->kind = XS_BOOLEAN_KIND;
2328
749k
      mxStack->value.boolean = index;
2329
749k
      mxBreak;
2330
      
2331
82.5M
    mxCase(XS_CODE_GET_THIS_VARIABLE)
2332
113M
    mxCase(XS_CODE_GET_VARIABLE)
2333
113M
      mxToInstance(mxStack);
2334
113M
      offset = mxRunID(1);
2335
113M
      index = 0;
2336
113M
      mxNextCode(1 + sizeof(txID));
2337
113M
    #ifdef mxWithHasGetSequence
2338
113M
      if (variable->next && ((variable->next->ID == XS_ENVIRONMENT_BEHAVIOR) || (variable->next->ID == XS_GLOBAL_BEHAVIOR))) {
2339
113M
      }
2340
434
      else {
2341
434
              mxSaveState;
2342
434
              index = fxRunHas(the, variable, (txID)offset, index);
2343
434
              mxRestoreState;
2344
434
        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
434
        else 
2351
434
          index = 0;
2352
434
      }
2353
113M
    #endif
2354
113M
      slot = mxBehaviorGetProperty(the, variable, (txID)offset, index, XS_ANY);
2355
113M
      if (slot) {
2356
112M
        if (slot->kind < 0)
2357
112M
          mxRunDebugID(XS_REFERENCE_ERROR, "get %s: not initialized yet", (txID)offset);
2358
112M
      }
2359
1.18M
      else {
2360
1.18M
        if (byte != XS_CODE_TYPEOF)
2361
817k
          mxRunDebugID(XS_REFERENCE_ERROR, "get %s: undefined variable", (txID)offset);
2362
370k
      }
2363
112M
      goto XS_CODE_GET_ALL;
2364
112M
    mxCase(XS_CODE_GET_SUPER_AT)
2365
45
      variable = (mxStack + 1)->value.super.reference;
2366
45
      slot = (mxStack + 1)->value.super.prototype;
2367
45
      offset = mxStack->value.at.id;
2368
45
      index = mxStack->value.at.index;
2369
45
      mxStack++;
2370
45
      mxNextCode(1);
2371
45
      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
45
    XS_CODE_GET_SUPER_ALL:  
2385
45
      slot = mxBehaviorGetProperty(the, slot, (txID)offset, index, XS_ANY);
2386
45
      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
7.62M
    mxCase(XS_CODE_GET_PROPERTY_AT)
2409
7.62M
      variable = (mxStack + 1)->value.reference;
2410
7.62M
      offset = mxStack->value.at.id;
2411
7.62M
      index = mxStack->value.at.index;
2412
7.62M
      mxStack++;
2413
7.62M
      mxNextCode(1);
2414
7.62M
      goto XS_CODE_GET_PROPERTY_ALL;
2415
62.0M
    mxCase(XS_CODE_GET_PROPERTY)
2416
62.0M
      mxToInstance(mxStack);
2417
62.0M
      offset = mxRunID(1);
2418
62.0M
      index = 0;
2419
62.0M
      mxNextCode(1 + sizeof(txID));
2420
      /* continue */
2421
69.5M
    XS_CODE_GET_PROPERTY_ALL: 
2422
69.5M
      slot = mxBehaviorGetProperty(the, variable, (txID)offset, index, XS_ANY);
2423
182M
    XS_CODE_GET_ALL:  
2424
#ifdef mxTrace
2425
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2426
#endif
2427
182M
      if (!slot) {
2428
16.4M
        mxStack->kind = XS_UNDEFINED_KIND;
2429
16.4M
        mxBreak;
2430
16.4M
      }
2431
182M
      if (slot->kind == XS_ACCESSOR_KIND) {
2432
2.38M
        variable = slot->value.accessor.getter;
2433
2.38M
        if (!mxIsFunction(variable)) {
2434
3
          mxStack->kind = XS_UNDEFINED_KIND;
2435
3
          mxBreak;
2436
3
        }
2437
2.38M
        mxAllocStack(3);
2438
2.38M
        slot = mxStack;
2439
2.38M
        mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2440
2.38M
        mxInitSlotKind(slot++, XS_UNDEFINED_KIND);
2441
2.38M
        slot->value.reference = variable;
2442
2.38M
        mxInitSlotKind(slot++, XS_REFERENCE_KIND);
2443
2.38M
        if (primitive) {
2444
1.19M
          variable = slot->value.reference->next;
2445
1.19M
          slot->value = variable->value;
2446
1.19M
          mxInitSlotKind(slot, variable->kind);
2447
1.19M
        }
2448
2.38M
        offset = 0;
2449
2.38M
        goto XS_CODE_RUN_ALL;
2450
2.38M
      }
2451
179M
      mxStack->kind = slot->kind;
2452
179M
      mxStack->value = slot->value;
2453
179M
      mxBreak;
2454
      
2455
179M
    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
9.46M
    mxCase(XS_CODE_NEW_PROPERTY_AT)
2474
9.46M
      mxToInstance(mxStack + 2);
2475
9.46M
      offset = (mxStack + 1)->value.at.id;
2476
9.46M
      index = (mxStack + 1)->value.at.index;
2477
9.46M
      slot = C_NULL;
2478
9.46M
      the->stack = mxStack;
2479
9.46M
      mxStack++;
2480
9.46M
      scratch = *(the->stack);
2481
9.46M
      *(the->stack) = *mxStack;
2482
9.46M
      *mxStack = scratch;
2483
9.46M
      mxNextCode(1);
2484
9.46M
      goto XS_CODE_NEW_PROPERTY_ALL;
2485
7.74M
    mxCase(XS_CODE_NEW_PROPERTY)
2486
7.74M
      mxToInstance(mxStack + 1);
2487
7.74M
      offset = mxRunID(1);
2488
7.74M
      index = 0;
2489
7.74M
      slot = C_NULL;
2490
7.74M
      the->stack = mxStack;
2491
7.74M
      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
448k
        mxStack->value.accessor.getter = fxToInstance(the, mxStack);
2497
448k
        mxStack->value.accessor.setter = C_NULL;
2498
448k
        mxStack->kind = XS_ACCESSOR_KIND;
2499
448k
      }
2500
16.7M
      else if (byte & XS_SETTER_FLAG) {
2501
2.62k
        mxStack->value.accessor.setter = fxToInstance(the, mxStack);
2502
2.62k
        mxStack->value.accessor.getter = C_NULL;
2503
2.62k
        mxStack->kind = XS_ACCESSOR_KIND;
2504
2.62k
      }
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
45.2M
    mxCase(XS_CODE_SET_VARIABLE)
2515
45.2M
      mxToInstance(mxStack + 1);
2516
45.2M
      offset = mxRunID(1);
2517
45.2M
      index = 0;
2518
45.2M
      mxNextCode(1 + sizeof(txID));
2519
45.2M
      if (variable->next && (variable->next->ID == XS_ENVIRONMENT_BEHAVIOR)) {
2520
        // nop
2521
7.04k
      }
2522
45.2M
      else {
2523
45.2M
              mxSaveState;
2524
45.2M
              index = fxRunHas(the, variable, (txID)offset, index);
2525
45.2M
              mxRestoreState;
2526
45.2M
        if (index == 0) {
2527
3.99k
          if (the->frame->flag & XS_STRICT_FLAG)
2528
3.89k
            mxRunDebugID(XS_REFERENCE_ERROR, "set %s: undefined property", (txID)offset);
2529
3.89k
        }
2530
45.2M
        else 
2531
45.2M
          index = 0;
2532
45.2M
      }
2533
45.2M
            mxSaveState;
2534
45.2M
      slot = mxBehaviorSetProperty(the, variable, (txID)offset, index, XS_ANY);
2535
45.2M
      mxRestoreState;
2536
45.2M
      if (slot && (slot->kind < 0))
2537
45.2M
        mxRunDebugID(XS_REFERENCE_ERROR, "set %s: not initialized yet", (txID)offset);
2538
45.2M
      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
3.18M
    mxCase(XS_CODE_SET_PROPERTY_AT)
2594
3.18M
      variable = (mxStack + 2)->value.reference;
2595
3.18M
      offset = (mxStack + 1)->value.at.id;
2596
3.18M
      index = (mxStack + 1)->value.at.index;
2597
3.18M
      the->stack = mxStack;
2598
3.18M
      mxStack++;
2599
3.18M
      scratch = *(the->stack);
2600
3.18M
      *(the->stack) = *mxStack;
2601
3.18M
      *mxStack = scratch;
2602
3.18M
      mxNextCode(1);
2603
3.18M
      goto XS_CODE_SET_PROPERTY_ALL;
2604
9.48M
    mxCase(XS_CODE_SET_PROPERTY)
2605
9.48M
      mxToInstance(mxStack + 1);
2606
9.48M
      offset = mxRunID(1);
2607
9.48M
      index = 0;
2608
9.48M
      the->stack = mxStack;
2609
9.48M
      mxNextCode(1 + sizeof(txID));
2610
      /* continue */
2611
12.6M
    XS_CODE_SET_PROPERTY_ALL: 
2612
12.6M
      mxSaveStateKeepStack;
2613
12.6M
      slot = mxBehaviorSetProperty(the, variable, (txID)offset, index, XS_ANY);
2614
12.6M
      mxRestoreStateKeepStack;
2615
57.9M
    XS_CODE_SET_ALL:  
2616
#ifdef mxTrace
2617
      if (gxDoTrace) fxTraceID(the, (txID)offset, index);
2618
#endif
2619
57.9M
      if (!slot) {
2620
34.7k
        if (mxFrame->flag & XS_STRICT_FLAG) {
2621
8
          mxRunDebugID(XS_TYPE_ERROR, "set %s: not extensible", (txID)offset);
2622
0
        }
2623
34.7k
        goto XS_CODE_SET_SKIP;
2624
34.7k
      }
2625
57.9M
      if (slot->kind == XS_ACCESSOR_KIND) {
2626
6.23M
        variable = slot->value.accessor.setter;
2627
6.23M
        if (!mxIsFunction(variable)) {
2628
12
          if (mxFrame->flag & XS_STRICT_FLAG) {
2629
1
            mxRunDebugID(XS_TYPE_ERROR, "set %s: no setter", (txID)offset);
2630
0
          }
2631
11
          goto XS_CODE_SET_SKIP;
2632
12
        }
2633
6.23M
        slot = mxStack;
2634
6.23M
        mxAllocStack(3);
2635
6.23M
        mxStack->value = slot->value;
2636
6.23M
        mxInitSlotKind(mxStack, slot->kind);
2637
6.23M
        slot = mxStack + 1;
2638
6.23M
        mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2639
6.23M
        slot->value = mxStack->value;
2640
6.23M
        mxInitSlotKind(slot++, mxStack->kind);
2641
6.23M
        slot->value.reference = variable;
2642
6.23M
        mxInitSlotKind(slot++, XS_REFERENCE_KIND);
2643
6.23M
        offset = 1;
2644
6.23M
        goto XS_CODE_RUN_ALL;
2645
6.23M
      }
2646
51.6M
      if (slot->flag & (XS_DONT_SET_FLAG | XS_MARK_FLAG)) {
2647
34.3k
        if (mxFrame->flag & XS_STRICT_FLAG) {
2648
3
          mxRunDebugID(XS_TYPE_ERROR, "set %s: not writable", (txID)offset);
2649
0
        }
2650
34.3k
        goto XS_CODE_SET_SKIP;
2651
34.3k
      }
2652
51.6M
      slot->kind = mxStack->kind;
2653
51.6M
      slot->value = mxStack->value;
2654
51.7M
    XS_CODE_SET_SKIP:
2655
51.7M
      *(mxStack + 1) = *mxStack;
2656
51.7M
      mxStack++;
2657
51.7M
      mxBreak;
2658
      
2659
51.7M
    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.39M
    mxCase(XS_CODE_ARRAY)
2686
//      mxAllocStack(1);
2687
5.39M
      mxSaveState;
2688
5.39M
      fxNewArray(the, 0);
2689
5.39M
      mxRestoreState;
2690
5.39M
      mxNextCode(1);
2691
5.39M
      mxBreak;
2692
5.39M
    mxCase(XS_CODE_CLASS)
2693
63.0k
      variable = fxToInstance(the, mxStack);
2694
63.0k
      slot = mxStack + 2;
2695
63.0k
      variable->flag |= XS_CAN_CONSTRUCT_FLAG;
2696
63.0k
      if (slot->kind == XS_NULL_KIND)
2697
5.73k
        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
63.0k
      slot = mxStack + 1;
2703
63.0k
      mxFunctionInstanceHome(variable)->value.home.object = slot->value.reference;
2704
63.0k
      mxSaveState;
2705
63.0k
      slot->flag = XS_GET_ONLY;
2706
63.0k
      fxRunDefine(the, variable, C_NULL, mxID(_prototype), 0, slot, XS_GET_ONLY);
2707
63.0k
      slot = mxBehaviorSetProperty(the, slot->value.reference, mxID(_constructor), 0, XS_OWN);
2708
63.0k
      mxRestoreState;
2709
63.0k
      slot->flag |= XS_DONT_ENUM_FLAG;
2710
63.0k
      slot->kind = mxStack->kind;
2711
63.0k
      slot->value = mxStack->value;
2712
63.0k
      mxStack += 3;
2713
63.0k
            mxNextCode(1);
2714
63.0k
      mxBreak;
2715
63.0k
    mxCase(XS_CODE_COPY_OBJECT)
2716
7.94k
      mxNextCode(1);
2717
7.94k
      mxAllocStack(1);
2718
7.94k
      *mxStack = mxCopyObjectFunction;
2719
7.94k
      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
434k
    mxCase(XS_CODE_GLOBAL)
2734
434k
      mxPushKind(XS_REFERENCE_KIND);
2735
434k
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
2736
434k
      variable = mxModuleInstanceInternal(variable)->value.module.realm;
2737
434k
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
2738
434k
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
2739
434k
      mxNextCode(1);
2740
434k
      mxBreak;
2741
434k
    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
118
    mxCase(XS_CODE_INSTANTIATE)
2756
118
      mxSaveState;
2757
118
      fxRunInstantiate(the);
2758
118
      mxRestoreState;
2759
118
      mxNextCode(1);
2760
118
      mxBreak;
2761
38.7M
    mxCase(XS_CODE_CALL)
2762
38.7M
      mxNextCode(1);
2763
38.7M
      mxAllocStack(2);
2764
38.7M
      slot = mxStack;
2765
38.7M
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2766
38.7M
      mxInitSlotKind(slot, XS_UNDEFINED_KIND);
2767
38.7M
      mxBreak;
2768
38.7M
    mxCase(XS_CODE_NEW)
2769
4.96M
      mxNextCode(1);
2770
4.96M
      variable = mxStack;
2771
4.96M
      mxAllocStack(4);
2772
4.96M
      slot = mxStack;
2773
4.96M
      mxInitSlotKind(slot++, XS_UNINITIALIZED_KIND);
2774
4.96M
      mxInitSlotKind(slot++, XS_UNDEFINED_KIND);
2775
4.96M
      slot->value = variable->value;
2776
4.96M
      mxInitSlotKind(slot++, variable->kind);
2777
4.96M
      mxInitSlotKind(slot, XS_UNINITIALIZED_KIND);
2778
4.96M
      mxBreak;
2779
4.96M
    mxCase(XS_CODE_OBJECT)
2780
//      mxAllocStack(1);
2781
4.14M
      mxSaveState;
2782
4.14M
      fxNewObject(the);
2783
4.14M
      mxRestoreState;
2784
4.14M
      mxNextCode(1);
2785
4.14M
      mxBreak;
2786
4.14M
    mxCase(XS_CODE_REGEXP)
2787
452k
      mxNextCode(1);
2788
452k
      mxAllocStack(1);
2789
452k
      *mxStack = mxRegExpConstructor;
2790
452k
      mxBreak;
2791
452k
    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.45k
    mxCase(XS_CODE_TEMPLATE)
2818
3.45k
      mxNextCode(1);
2819
3.45k
      variable = mxStack->value.reference;
2820
3.45k
      slot = mxBehaviorGetProperty(the, variable, mxID(_raw), 0, XS_OWN);
2821
3.45k
            if (!slot)
2822
3.45k
        mxRunDebug(XS_TYPE_ERROR, "template: no raw");
2823
3.45k
      variable->flag |= XS_DONT_PATCH_FLAG;
2824
3.45k
      variable->next->flag |= XS_DONT_SET_FLAG;
2825
3.45k
      slot->flag |= XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG;
2826
3.45k
      variable = slot->value.reference;
2827
3.45k
      variable->flag |= XS_DONT_PATCH_FLAG;
2828
3.45k
      variable->next->flag |= XS_DONT_SET_FLAG;
2829
3.45k
      mxBreak;
2830
4.21M
    mxCase(XS_CODE_TEMPLATE_CACHE)
2831
4.21M
      mxNextCode(1);
2832
4.21M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
2833
4.21M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
2834
4.21M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
2835
4.21M
            slot = mxRealmTemplateCache(variable);
2836
4.21M
      mxPushKind(XS_REFERENCE_KIND);
2837
4.21M
      mxStack->value.reference = slot->value.reference;
2838
4.21M
      mxBreak;
2839
      
2840
  /* FUNCTIONS */    
2841
4.21M
    mxCase(XS_CODE_ASYNC_FUNCTION)
2842
1.02M
      offset = mxRunID(1);
2843
#ifdef mxTrace
2844
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2845
#endif
2846
1.02M
      mxAllocStack(1);
2847
1.02M
      *mxStack = mxAsyncFunctionPrototype;
2848
1.02M
      mxSaveState;
2849
1.02M
      fxNewFunctionInstance(the, (txID)offset);
2850
1.02M
      mxRestoreState;
2851
1.02M
      mxNextCode(1 + sizeof(txID));
2852
1.02M
      mxBreak;
2853
1.02M
    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
1.77M
    mxCase(XS_CODE_CONSTRUCTOR_FUNCTION)
2866
1.77M
      offset = mxRunID(1);
2867
#ifdef mxTrace
2868
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2869
#endif
2870
1.77M
      mxAllocStack(1);
2871
1.77M
      *mxStack = mxFunctionPrototype;
2872
1.77M
      mxSaveState;
2873
1.77M
      fxNewFunctionInstance(the, (txID)offset);
2874
1.77M
      fxDefaultFunctionPrototype(the);
2875
1.77M
      mxRestoreState;
2876
1.77M
      mxNextCode(1 + sizeof(txID));
2877
1.77M
      mxBreak;
2878
1.88M
    mxCase(XS_CODE_FUNCTION)
2879
1.88M
      offset = mxRunID(1);
2880
#ifdef mxTrace
2881
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2882
#endif
2883
1.88M
      mxAllocStack(1);
2884
1.88M
      *mxStack = mxFunctionPrototype;
2885
1.88M
      mxSaveState;
2886
1.88M
      fxNewFunctionInstance(the, (txID)offset);
2887
1.88M
      mxRestoreState;
2888
1.88M
      mxNextCode(1 + sizeof(txID));
2889
1.88M
      mxBreak;
2890
1.88M
    mxCase(XS_CODE_GENERATOR_FUNCTION)
2891
29.6k
      offset = mxRunID(1);
2892
#ifdef mxTrace
2893
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2894
#endif
2895
29.6k
      mxAllocStack(1);
2896
29.6k
      *mxStack = mxGeneratorFunctionPrototype;
2897
29.6k
      mxSaveState;
2898
29.6k
      gxDefaults.newGeneratorFunctionInstance(the,(txID) offset);
2899
29.6k
      mxRestoreState;
2900
29.6k
      mxNextCode(1 + sizeof(txID));
2901
29.6k
      mxBreak;
2902
4.72M
    mxCase(XS_CODE_PROFILE)
2903
4.72M
      offset = mxRunID(1);
2904
4.72M
      variable = mxFunctionInstanceHome(mxStack->value.reference);
2905
4.72M
      variable->ID = offset;
2906
4.72M
      mxNextCode(1 + sizeof(txID));
2907
4.72M
      mxBreak;
2908
4.72M
    mxCase(XS_CODE_NAME)
2909
62.6k
      offset = mxRunID(1);
2910
#ifdef mxTrace
2911
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
2912
#endif
2913
62.6k
      mxSaveState;
2914
62.6k
      fxRenameFunction(the, mxStack->value.reference, (txID)offset, 0, XS_NO_ID, C_NULL);
2915
62.6k
      mxRestoreState;
2916
62.6k
      mxNextCode(1 + sizeof(txID));
2917
62.6k
      mxBreak;
2918
62.6k
    mxCase(XS_CODE_SET_HOME)
2919
3.34k
      slot = mxFunctionInstanceHome((mxStack + 1)->value.reference);
2920
3.34k
      slot->value.home.object = mxStack->value.reference;
2921
3.34k
      mxStack++;
2922
3.34k
      mxNextCode(1);
2923
3.34k
      mxBreak;
2924
6.18k
    mxCase(XS_CODE_CODE_4)
2925
6.18k
      offset = mxRunS4(1);
2926
6.18k
      mxSkipCode(5);
2927
6.18k
      goto XS_CODE_CODE;
2928
1.00M
    mxCase(XS_CODE_CODE_2)
2929
1.00M
      offset = mxRunS2(1);
2930
1.00M
      mxSkipCode(3);
2931
1.00M
      goto XS_CODE_CODE;
2932
3.71M
    mxCase(XS_CODE_CODE_1)
2933
3.71M
      offset = mxRunS1(1);
2934
3.71M
      mxSkipCode(2);
2935
4.72M
    XS_CODE_CODE:
2936
4.72M
      mxSaveState;
2937
4.72M
      scratch.value.code.address = (txByte*)fxNewChunk(the, (txSize)offset);
2938
4.72M
      mxRestoreState;
2939
4.72M
      c_memcpy(scratch.value.code.address, mxCode, offset);
2940
4.72M
      variable = mxStack->value.reference;
2941
4.72M
      slot = mxFunctionInstanceCode(variable);
2942
4.72M
      slot->kind = XS_CODE_KIND;
2943
4.72M
      slot->value.code.address = scratch.value.code.address;
2944
4.72M
      if (gxDefaults.newFunctionLength) {
2945
4.72M
        gxDefaults.newFunctionLength(the, variable, *(((txU1*)scratch.value.code.address + 1)));
2946
4.72M
      }
2947
4.72M
      mxNextCode(offset);
2948
4.72M
      mxBreak;
2949
4.72M
    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
21.9M
    mxCase(XS_CODE_UNDEFINED)
2973
21.9M
      mxPushKind(XS_UNDEFINED_KIND);
2974
21.9M
      mxNextCode(1);
2975
21.9M
      mxBreak; 
2976
21.9M
    mxCase(XS_CODE_NULL)
2977
2.95M
      mxPushKind(XS_NULL_KIND);
2978
2.95M
      mxNextCode(1);
2979
2.95M
      mxBreak; 
2980
8.62M
    mxCase(XS_CODE_FALSE)
2981
8.62M
      mxPushKind(XS_BOOLEAN_KIND);
2982
8.62M
      mxStack->value.boolean = 0;
2983
8.62M
      mxNextCode(1);
2984
8.62M
      mxBreak;
2985
17.3M
    mxCase(XS_CODE_TRUE)
2986
17.3M
      mxPushKind(XS_BOOLEAN_KIND);
2987
17.3M
      mxStack->value.boolean = 1;
2988
17.3M
      mxNextCode(1);
2989
17.3M
      mxBreak;
2990
106M
    mxCase(XS_CODE_INTEGER_1)
2991
106M
      mxPushKind(XS_INTEGER_KIND);
2992
106M
      mxStack->value.integer = mxRunS1(1);
2993
106M
      mxNextCode(2);
2994
#ifdef mxTrace
2995
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
2996
#endif
2997
106M
      mxBreak;
2998
106M
    mxCase(XS_CODE_INTEGER_2)
2999
12.2M
      mxPushKind(XS_INTEGER_KIND);
3000
12.2M
      mxStack->value.integer = mxRunS2(1);
3001
12.2M
      mxNextCode(3);
3002
#ifdef mxTrace
3003
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
3004
#endif
3005
12.2M
      mxBreak;
3006
12.2M
    mxCase(XS_CODE_INTEGER_4)
3007
9.04M
      mxPushKind(XS_INTEGER_KIND);
3008
9.04M
      mxStack->value.integer = mxRunS4(1);
3009
9.04M
      mxNextCode(5);
3010
#ifdef mxTrace
3011
      if (gxDoTrace) fxTraceInteger(the, mxStack->value.integer);
3012
#endif
3013
9.04M
      mxBreak;
3014
15.1M
    mxCase(XS_CODE_NUMBER)
3015
15.1M
      mxPushKind(XS_NUMBER_KIND);
3016
15.1M
      {
3017
15.1M
        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
15.1M
        number[0] = mxCode[1];
3029
15.1M
        number[1] = mxCode[2];
3030
15.1M
        number[2] = mxCode[3];
3031
15.1M
        number[3] = mxCode[4];
3032
15.1M
        number[4] = mxCode[5];
3033
15.1M
        number[5] = mxCode[6];
3034
15.1M
        number[6] = mxCode[7];
3035
15.1M
        number[7] = mxCode[8];
3036
15.1M
      #endif
3037
15.1M
      }
3038
15.1M
      mxNextCode(9);
3039
#ifdef mxTrace
3040
      if (gxDoTrace) fxTraceNumber(the, mxStack->value.number);
3041
#endif
3042
15.1M
      mxBreak;
3043
      
3044
15.1M
    mxCase(XS_CODE_STRING_4)
3045
0
      index = mxRunS4(1);
3046
0
      mxSkipCode(5);
3047
0
      goto XS_CODE_STRING;
3048
2.57M
    mxCase(XS_CODE_STRING_2)
3049
2.57M
      index = mxRunU2(1);
3050
2.57M
      mxSkipCode(3);
3051
2.57M
      goto XS_CODE_STRING;
3052
18.3M
    mxCase(XS_CODE_STRING_1)
3053
18.3M
      index = mxRunU1(1);
3054
18.3M
      mxSkipCode(2);
3055
20.9M
    XS_CODE_STRING:
3056
20.9M
      mxSaveState;
3057
20.9M
      scratch.value.string = (txString)fxNewChunk(the, index);
3058
20.9M
      mxRestoreState;
3059
20.9M
      c_memcpy(scratch.value.string, mxCode, index);
3060
20.9M
      mxPushKind(XS_STRING_KIND);
3061
20.9M
      mxStack->value.string = scratch.value.string;
3062
20.9M
      mxNextCode(index);
3063
#ifdef mxTrace
3064
      if (gxDoTrace) fxTraceString(the, mxStack->value.string);
3065
#endif
3066
20.9M
      mxBreak;
3067
20.9M
    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
184k
    mxCase(XS_CODE_TO_STRING)
3087
184k
      mxToString(mxStack);
3088
184k
      mxNextCode(1);
3089
184k
      mxBreak;
3090
      
3091
184k
    mxCase(XS_CODE_SYMBOL)
3092
1.16k
      mxPushKind(XS_SYMBOL_KIND);
3093
1.16k
      mxStack->value.symbol = mxRunID(1);
3094
#ifdef mxTrace
3095
      if (gxDoTrace) fxTraceID(the, mxStack->value.symbol, 0);
3096
#endif
3097
1.16k
      mxNextCode(1 + sizeof(txID));
3098
1.16k
      mxBreak;
3099
      
3100
1.16k
    mxCase(XS_CODE_BIGINT_2)
3101
1
      index = mxRunU2(1);
3102
1
      mxSkipCode(3);
3103
1
      goto XS_CODE_BIGINT;
3104
8.15M
    mxCase(XS_CODE_BIGINT_1)
3105
8.15M
      index = mxRunU1(1);
3106
8.15M
      mxSkipCode(2);
3107
8.15M
    XS_CODE_BIGINT:
3108
8.15M
      mxSaveState;
3109
8.15M
      gxTypeBigInt.decode(the, index);
3110
8.15M
      mxRestoreState;
3111
8.15M
      mxNextCode(index);
3112
8.15M
      mxBreak;
3113
3114
  /* EXPRESSIONS */ 
3115
8.15M
    mxCase(XS_CODE_BIT_NOT)
3116
5.18M
      if (mxStack->kind == XS_INTEGER_KIND)
3117
3.34M
        mxStack->value.integer = ~mxStack->value.integer;
3118
1.84M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3119
825k
        mxStack->kind = XS_INTEGER_KIND;
3120
825k
        mxStack->value.integer = ~fxNumberToInteger(mxStack->value.number);
3121
825k
        mxFloatingPointOp("not");
3122
825k
      }
3123
1.02M
      else {
3124
1.02M
        mxSaveState;
3125
1.02M
        if (fxToNumericIntegerUnary(the, mxStack, gxTypeBigInt._not))
3126
742k
          mxStack->value.integer = ~mxStack->value.integer;
3127
1.02M
        mxRestoreState;
3128
1.02M
      }
3129
5.18M
      mxNextCode(1);
3130
5.18M
      mxBreak;
3131
5.18M
    mxCase(XS_CODE_BIT_AND)
3132
4.10M
      slot = mxStack + 1;
3133
4.10M
      if (slot->kind == XS_INTEGER_KIND) {
3134
2.18M
        if (mxStack->kind == XS_INTEGER_KIND)
3135
1.40M
          slot->value.integer &= mxStack->value.integer;
3136
777k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3137
542k
          slot->value.integer &= fxNumberToInteger(mxStack->value.number);
3138
542k
          mxFloatingPointOp("and");
3139
542k
        }
3140
235k
        else
3141
235k
          goto XS_CODE_BIT_AND_GENERAL;
3142
2.18M
      }
3143
1.92M
      else if (slot->kind == XS_NUMBER_KIND) {
3144
126k
        if (mxStack->kind == XS_INTEGER_KIND) {
3145
76.3k
          slot->kind = XS_INTEGER_KIND;
3146
76.3k
          slot->value.integer = fxNumberToInteger(slot->value.number) & mxStack->value.integer;
3147
76.3k
          mxFloatingPointOp("and");
3148
76.3k
        }
3149
50.1k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3150
41.4k
          slot->kind = XS_INTEGER_KIND;
3151
41.4k
          slot->value.integer = fxNumberToInteger(slot->value.number) & fxNumberToInteger(mxStack->value.number);
3152
41.4k
          mxFloatingPointOp("and");
3153
41.4k
        }
3154
8.75k
        else
3155
8.75k
          goto XS_CODE_BIT_AND_GENERAL;
3156
126k
      }
3157
1.80M
      else {
3158
2.04M
    XS_CODE_BIT_AND_GENERAL:
3159
2.04M
        mxSaveState;
3160
2.04M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._and))
3161
2.03M
          slot->value.integer &= mxStack->value.integer;
3162
2.04M
        mxRestoreState;
3163
2.04M
      }
3164
4.10M
      mxStack++;
3165
4.10M
      mxNextCode(1);
3166
4.10M
      mxBreak;
3167
5.98M
    mxCase(XS_CODE_BIT_OR)
3168
5.98M
      slot = mxStack + 1;
3169
5.98M
      if (slot->kind == XS_INTEGER_KIND) {
3170
4.12M
        if (mxStack->kind == XS_INTEGER_KIND)
3171
3.20M
          slot->value.integer |= mxStack->value.integer;
3172
922k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3173
595k
          slot->value.integer |= fxNumberToInteger(mxStack->value.number);
3174
595k
          mxFloatingPointOp("or");
3175
595k
        }
3176
326k
        else
3177
326k
          goto XS_CODE_BIT_OR_GENERAL;
3178
4.12M
      }
3179
1.86M
      else if (slot->kind == XS_NUMBER_KIND) {
3180
1.16M
        if (mxStack->kind == XS_INTEGER_KIND) {
3181
1.14M
          slot->kind = XS_INTEGER_KIND;
3182
1.14M
          slot->value.integer = fxNumberToInteger(slot->value.number) | mxStack->value.integer;
3183
1.14M
          mxFloatingPointOp("or");
3184
1.14M
        }
3185
18.2k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3186
1.07k
          slot->kind = XS_INTEGER_KIND;
3187
1.07k
          slot->value.integer = fxNumberToInteger(slot->value.number) | fxNumberToInteger(mxStack->value.number);
3188
1.07k
          mxFloatingPointOp("or");
3189
1.07k
        }
3190
17.1k
        else
3191
17.1k
          goto XS_CODE_BIT_OR_GENERAL;
3192
1.16M
      }
3193
699k
      else {
3194
1.04M
    XS_CODE_BIT_OR_GENERAL:
3195
1.04M
        mxSaveState;
3196
1.04M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._or))
3197
839k
          slot->value.integer |= mxStack->value.integer;
3198
1.04M
        mxRestoreState;
3199
1.04M
      }
3200
5.98M
      mxStack++;
3201
5.98M
      mxNextCode(1);
3202
5.98M
      mxBreak;
3203
5.98M
    mxCase(XS_CODE_BIT_XOR)
3204
2.17M
      slot = mxStack + 1;
3205
2.17M
      if (slot->kind == XS_INTEGER_KIND) {
3206
1.15M
        if (mxStack->kind == XS_INTEGER_KIND)
3207
826k
          slot->value.integer ^= mxStack->value.integer;
3208
331k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3209
54.6k
          slot->value.integer ^= fxNumberToInteger(mxStack->value.number);
3210
54.6k
          mxFloatingPointOp("xor");
3211
54.6k
        }
3212
276k
        else
3213
276k
          goto XS_CODE_BIT_XOR_GENERAL;
3214
1.15M
      }
3215
1.01M
      else if (slot->kind == XS_NUMBER_KIND) {
3216
60.9k
        if (mxStack->kind == XS_INTEGER_KIND) {
3217
60.4k
          slot->kind = XS_INTEGER_KIND;
3218
60.4k
          slot->value.integer = fxNumberToInteger(slot->value.number) ^ mxStack->value.integer;
3219
60.4k
          mxFloatingPointOp("xor");
3220
60.4k
        }
3221
557
        else if (mxStack->kind == XS_NUMBER_KIND) {
3222
194
          slot->kind = XS_INTEGER_KIND;
3223
194
          slot->value.integer = fxNumberToInteger(slot->value.number) ^ fxNumberToInteger(mxStack->value.number);
3224
194
          mxFloatingPointOp("xor");
3225
194
        }
3226
363
        else
3227
363
          goto XS_CODE_BIT_XOR_GENERAL;
3228
60.9k
      }
3229
956k
      else {
3230
1.23M
    XS_CODE_BIT_XOR_GENERAL:
3231
1.23M
        mxSaveState;
3232
1.23M
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._xor))
3233
1.14M
          slot->value.integer ^= mxStack->value.integer;
3234
1.23M
        mxRestoreState;
3235
1.23M
      }
3236
2.17M
      mxStack++;
3237
2.17M
      mxNextCode(1);
3238
2.17M
      mxBreak;
3239
      
3240
2.17M
    mxCase(XS_CODE_LEFT_SHIFT)
3241
1.38M
      slot = mxStack + 1;
3242
1.38M
      if (slot->kind == XS_INTEGER_KIND) {
3243
997k
        if (mxStack->kind == XS_INTEGER_KIND)
3244
921k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (mxStack->value.integer & 0x1f));
3245
75.4k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3246
24.5k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (fxNumberToInteger(mxStack->value.number) & 0x1f));
3247
24.5k
          mxFloatingPointOp("left shift");
3248
24.5k
        }
3249
50.9k
        else
3250
50.9k
          goto XS_CODE_LEFT_SHIFT_GENERAL;
3251
997k
      }
3252
388k
      else if (slot->kind == XS_NUMBER_KIND) {
3253
368k
        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
170k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3259
40.0k
          slot->kind = XS_INTEGER_KIND;
3260
40.0k
          slot->value.integer = (txInteger)(((txUnsigned)fxNumberToInteger(slot->value.number)) << (fxNumberToInteger(mxStack->value.number) & 0x1f));
3261
40.0k
          mxFloatingPointOp("left shift");
3262
40.0k
        }
3263
129k
        else
3264
129k
          goto XS_CODE_LEFT_SHIFT_GENERAL;
3265
368k
      }
3266
19.7k
      else {
3267
200k
    XS_CODE_LEFT_SHIFT_GENERAL:
3268
200k
        mxSaveState;
3269
200k
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._lsl))
3270
198k
          slot->value.integer = (txInteger)(((txUnsigned)slot->value.integer) << (mxStack->value.integer & 0x1f));
3271
200k
        mxRestoreState;
3272
200k
      }
3273
1.38M
      mxStack++;
3274
1.38M
      mxNextCode(1);
3275
1.38M
      mxBreak;
3276
2.15M
    mxCase(XS_CODE_SIGNED_RIGHT_SHIFT)
3277
2.15M
      slot = mxStack + 1;
3278
2.15M
      if (slot->kind == XS_INTEGER_KIND) {
3279
1.15M
        if (mxStack->kind == XS_INTEGER_KIND)
3280
435k
          slot->value.integer >>= mxStack->value.integer & 0x1f;
3281
718k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3282
244k
          slot->value.integer >>= fxNumberToInteger(mxStack->value.number) & 0x1f;
3283
244k
          mxFloatingPointOp("signed right shift");
3284
244k
        }
3285
474k
        else
3286
474k
          goto XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL;
3287
1.15M
      }
3288
1.00M
      else if (slot->kind == XS_NUMBER_KIND) {
3289
891k
        if (mxStack->kind == XS_INTEGER_KIND) {
3290
474k
          slot->kind = XS_INTEGER_KIND;
3291
474k
          slot->value.integer = fxNumberToInteger(slot->value.number) >> (mxStack->value.integer & 0x1f);
3292
474k
          mxFloatingPointOp("signed right shift");
3293
474k
        }
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.73k
        else
3300
1.73k
          goto XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL;
3301
891k
      }
3302
112k
      else {
3303
587k
    XS_CODE_SIGNED_RIGHT_SHIFT_GENERAL:
3304
587k
        mxSaveState;
3305
587k
        if (fxToNumericIntegerBinary(the, slot, mxStack, gxTypeBigInt._lsr))
3306
572k
          slot->value.integer >>= mxStack->value.integer & 0x1f;
3307
587k
        mxRestoreState;
3308
587k
      }
3309
2.15M
      mxStack++;
3310
2.15M
      mxNextCode(1);
3311
2.15M
      mxBreak;
3312
2.15M
    mxCase(XS_CODE_UNSIGNED_RIGHT_SHIFT)
3313
1.76M
      slot = mxStack + 1;
3314
1.76M
      if (((slot->kind == XS_INTEGER_KIND) || (slot->kind == XS_NUMBER_KIND)) && ((mxStack->kind == XS_INTEGER_KIND) || (mxStack->kind == XS_NUMBER_KIND))) {
3315
1.37M
        fxUnsigned(the, slot, fxToUnsigned(the, slot) >> (fxToUnsigned(the, mxStack) & 0x1F));
3316
1.37M
      }
3317
390k
      else {
3318
390k
        mxSaveState;
3319
390k
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._nop))
3320
390k
          fxUnsigned(the, slot, fxToUnsigned(the, slot) >> (fxToUnsigned(the, mxStack) & 0x1F));
3321
390k
        mxRestoreState;
3322
390k
      }
3323
1.76M
      mxStack++;
3324
1.76M
      mxNextCode(1);
3325
1.76M
      mxBreak;
3326
        
3327
17.9M
    mxCase(XS_CODE_MINUS)
3328
17.9M
      if (mxStack->kind == XS_INTEGER_KIND) {
3329
9.87M
        if (mxStack->value.integer & 0x7FFFFFFF)
3330
6.72M
          mxStack->value.integer = -mxStack->value.integer;
3331
3.14M
        else {
3332
3.14M
          mxStack->kind = XS_NUMBER_KIND;
3333
3.14M
          mxStack->value.number = -((txNumber)(mxStack->value.integer));
3334
3.14M
          mxFloatingPointOp("minus");
3335
3.14M
        }
3336
9.87M
      }
3337
8.11M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3338
1.47M
        mxStack->value.number = -mxStack->value.number;
3339
1.47M
        mxFloatingPointOp("minus");
3340
1.47M
      }
3341
6.64M
      else {
3342
6.64M
        mxSaveState;
3343
6.64M
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._neg)) {
3344
2.17M
          mxStack->value.number = -mxStack->value.number;
3345
2.17M
          mxFloatingPointOp("minus");
3346
2.17M
        }
3347
6.64M
        mxRestoreState;
3348
6.64M
      }
3349
17.9M
      mxNextCode(1);
3350
17.9M
      mxBreak;
3351
17.9M
    mxCase(XS_CODE_PLUS)
3352
5.96M
      if (mxStack->kind != XS_INTEGER_KIND) {
3353
2.01M
        mxToNumber(mxStack);
3354
2.01M
      }
3355
5.96M
      mxNextCode(1);
3356
5.96M
      mxBreak;
3357
      
3358
5.96M
    mxCase(XS_CODE_TO_NUMERIC)
3359
4.45M
      if ((mxStack->kind != XS_INTEGER_KIND) && (mxStack->kind != XS_NUMBER_KIND)) {
3360
2.55M
        mxSaveState;
3361
2.55M
        fxToNumericNumber(the, mxStack);
3362
2.55M
        mxRestoreState;
3363
2.55M
      }
3364
4.45M
      mxNextCode(1);
3365
4.45M
      mxBreak;
3366
5.24M
    mxCase(XS_CODE_DECREMENT)
3367
5.24M
      if (mxStack->kind == XS_INTEGER_KIND) {
3368
920k
        if (mxStack->value.integer != -2147483647)
3369
920k
          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
920k
      }
3377
4.32M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3378
3.98M
        mxStack->value.number--;
3379
3.98M
        mxFloatingPointOp("decrement");
3380
3.98M
      }
3381
342k
      else {
3382
342k
        mxSaveState;
3383
342k
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._dec)) {
3384
342k
          mxStack->value.number--;
3385
342k
          mxFloatingPointOp("decrement");
3386
342k
        }
3387
342k
        mxRestoreState;
3388
342k
      }
3389
5.24M
      mxNextCode(1);
3390
5.24M
      mxBreak;
3391
28.3M
    mxCase(XS_CODE_INCREMENT)
3392
28.3M
      if (mxStack->kind == XS_INTEGER_KIND) {
3393
18.6M
        if (mxStack->value.integer != 2147483647)
3394
18.6M
          mxStack->value.integer++;
3395
505
        else {
3396
505
          mxStack->kind = XS_NUMBER_KIND;
3397
505
          mxStack->value.number = mxStack->value.integer;
3398
505
          mxStack->value.number++;
3399
505
          mxFloatingPointOp("increment");
3400
505
        }
3401
18.6M
      }
3402
9.70M
      else if (mxStack->kind == XS_NUMBER_KIND) {
3403
6.08M
        mxStack->value.number++;
3404
6.08M
        mxFloatingPointOp("increment");
3405
6.08M
      }
3406
3.61M
      else {
3407
3.61M
        mxSaveState;
3408
3.61M
        if (fxToNumericNumberUnary(the, mxStack, gxTypeBigInt._inc)) {
3409
2.58M
          mxStack->value.number++;
3410
2.58M
          mxFloatingPointOp("increment");
3411
2.58M
        }
3412
3.61M
        mxRestoreState;
3413
3.61M
      }
3414
28.3M
      mxNextCode(1);
3415
28.3M
      mxBreak;
3416
      
3417
28.3M
    mxCase(XS_CODE_ADD)
3418
11.9M
      slot = mxStack + 1;
3419
11.9M
      if (slot->kind == XS_INTEGER_KIND) {
3420
6.45M
        if (mxStack->kind == XS_INTEGER_KIND) {
3421
4.40M
          #if __has_builtin(__builtin_add_overflow)
3422
4.40M
            if (__builtin_add_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3423
1.12k
              slot->kind = XS_NUMBER_KIND;
3424
1.12k
              slot->value.number = (txNumber)(slot->value.integer) + (txNumber)(mxStack->value.integer);
3425
1.12k
              mxFloatingPointOp("add");
3426
1.12k
            }
3427
4.40M
            else
3428
4.40M
              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
4.40M
        }
3442
2.04M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3443
1.49M
          slot->kind = XS_NUMBER_KIND;
3444
1.49M
          slot->value.number = (txNumber)(slot->value.integer) + mxStack->value.number;
3445
1.49M
          mxFloatingPointOp("add");
3446
1.49M
        }
3447
555k
        else
3448
555k
          goto XS_CODE_ADD_GENERAL;
3449
6.45M
      }
3450
5.51M
      else if (slot->kind == XS_NUMBER_KIND) {
3451
2.02M
        if (mxStack->kind == XS_INTEGER_KIND) {
3452
1.00M
          slot->value.number += (txNumber)(mxStack->value.integer);
3453
1.00M
          mxFloatingPointOp("add");
3454
1.00M
        }
3455
1.02M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3456
809k
          slot->value.number += mxStack->value.number;
3457
809k
          mxFloatingPointOp("add");
3458
809k
        }
3459
216k
        else
3460
216k
          goto XS_CODE_ADD_GENERAL;
3461
2.02M
      }
3462
3.48M
      else {
3463
4.26M
    XS_CODE_ADD_GENERAL:
3464
4.26M
        mxSaveState;
3465
4.26M
        fxToPrimitive(the, slot, XS_NO_HINT);
3466
4.26M
        fxToPrimitive(the, mxStack, XS_NO_HINT);
3467
4.26M
        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.68M
          fxToString(the, slot);
3469
3.68M
          fxToString(the, mxStack);
3470
3.68M
          fxConcatString(the, slot, mxStack);
3471
3.68M
        }
3472
573k
        else {
3473
573k
          if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._add)) {
3474
559k
            slot->value.number += mxStack->value.number;
3475
559k
            mxFloatingPointOp("add");
3476
559k
          }
3477
573k
        }
3478
4.26M
        mxRestoreState;
3479
4.26M
      }
3480
11.9M
      mxStack++;
3481
11.9M
      mxNextCode(1);
3482
11.9M
      mxBreak;
3483
13.1M
    mxCase(XS_CODE_SUBTRACT)
3484
13.1M
      slot = mxStack + 1;
3485
13.1M
      if (slot->kind == XS_INTEGER_KIND) {
3486
7.04M
        if (mxStack->kind == XS_INTEGER_KIND) {
3487
4.53M
          #if __has_builtin(__builtin_sub_overflow)
3488
4.53M
            if (__builtin_sub_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3489
1.81k
              slot->kind = XS_NUMBER_KIND;
3490
1.81k
              slot->value.number = (txNumber)(slot->value.integer) - (txNumber)(mxStack->value.integer);
3491
1.81k
              mxFloatingPointOp("subtract");
3492
1.81k
            }
3493
4.52M
            else
3494
4.52M
              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.53M
        }
3508
2.51M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3509
1.83M
          slot->kind = XS_NUMBER_KIND;
3510
1.83M
          slot->value.number = (txNumber)(slot->value.integer) - mxStack->value.number;
3511
1.83M
          mxFloatingPointOp("subtract");
3512
1.83M
        }
3513
680k
        else
3514
680k
          goto XS_CODE_SUBTRACT_GENERAL;
3515
7.04M
      }
3516
6.14M
      else if (slot->kind == XS_NUMBER_KIND) {
3517
4.32M
        if (mxStack->kind == XS_INTEGER_KIND) {
3518
398k
          slot->value.number -= (txNumber)(mxStack->value.integer);
3519
398k
          mxFloatingPointOp("subtract");
3520
398k
        }
3521
3.92M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3522
3.18M
          slot->value.number -= mxStack->value.number;
3523
3.18M
          mxFloatingPointOp("subtract");
3524
3.18M
        }
3525
742k
        else
3526
742k
          goto XS_CODE_SUBTRACT_GENERAL;
3527
4.32M
      }
3528
1.81M
      else {
3529
3.24M
    XS_CODE_SUBTRACT_GENERAL:
3530
3.24M
        mxSaveState;
3531
3.24M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._sub)) {
3532
3.23M
          slot->value.number -= mxStack->value.number;
3533
3.23M
          mxFloatingPointOp("subtract");
3534
3.23M
        }
3535
3.24M
        mxRestoreState;
3536
3.24M
      }
3537
13.1M
      mxStack++;
3538
13.1M
      mxNextCode(1);
3539
13.1M
      mxBreak;
3540
      
3541
13.1M
    mxCase(XS_CODE_DIVIDE)
3542
6.93M
      slot = mxStack + 1;
3543
6.93M
      if (slot->kind == XS_INTEGER_KIND) {
3544
4.09M
        if (mxStack->kind == XS_INTEGER_KIND) {
3545
3.24M
          slot->kind = XS_NUMBER_KIND;
3546
3.24M
          slot->value.number = (txNumber)(slot->value.integer) / (txNumber)(mxStack->value.integer);
3547
3.24M
        }
3548
853k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3549
510k
          slot->kind = XS_NUMBER_KIND;
3550
510k
          slot->value.number = (txNumber)(slot->value.integer) / mxStack->value.number;
3551
510k
        }
3552
342k
        else
3553
342k
          goto XS_CODE_DIVIDE_GENERAL;
3554
4.09M
      }
3555
2.83M
      else if (slot->kind == XS_NUMBER_KIND) {
3556
1.91M
        if (mxStack->kind == XS_INTEGER_KIND)
3557
1.11M
          slot->value.number /= (txNumber)(mxStack->value.integer);
3558
802k
        else if (mxStack->kind == XS_NUMBER_KIND)
3559
284k
          slot->value.number /= mxStack->value.number;
3560
518k
        else
3561
518k
          goto XS_CODE_DIVIDE_GENERAL;
3562
1.91M
      }
3563
917k
      else {
3564
1.77M
    XS_CODE_DIVIDE_GENERAL:
3565
1.77M
        mxSaveState;
3566
1.77M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._div))
3567
1.76M
          slot->value.number /= mxStack->value.number;
3568
1.77M
        mxRestoreState;
3569
1.77M
      }
3570
6.93M
      mxFloatingPointOp("divide");
3571
6.93M
      mxStack++;
3572
6.93M
      mxNextCode(1);
3573
6.93M
      mxBreak;
3574
6.93M
    mxCase(XS_CODE_EXPONENTIATION)
3575
4.44M
      slot = mxStack + 1;
3576
4.44M
      if (slot->kind == XS_INTEGER_KIND) {
3577
2.81M
        if (mxStack->kind == XS_INTEGER_KIND) {
3578
377k
          slot->kind = XS_NUMBER_KIND;
3579
377k
          slot->value.number = fx_pow((txNumber)(slot->value.integer), (txNumber)(mxStack->value.integer));
3580
377k
        }
3581
2.43M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3582
597k
          slot->kind = XS_NUMBER_KIND;
3583
597k
          slot->value.number = fx_pow((txNumber)(slot->value.integer), mxStack->value.number);
3584
597k
        }
3585
1.83M
        else
3586
1.83M
          goto XS_CODE_EXPONENTIATION_GENERAL;
3587
2.81M
      }
3588
1.63M
      else if (slot->kind == XS_NUMBER_KIND) {
3589
1.57M
        if (mxStack->kind == XS_INTEGER_KIND)
3590
335k
          slot->value.number = fx_pow(slot->value.number, (txNumber)(mxStack->value.integer));
3591
1.23M
        else if (mxStack->kind == XS_NUMBER_KIND)
3592
750k
          slot->value.number = fx_pow(slot->value.number, mxStack->value.number);
3593
487k
        else
3594
487k
          goto XS_CODE_EXPONENTIATION_GENERAL;
3595
1.57M
      }
3596
57.2k
      else {
3597
2.38M
    XS_CODE_EXPONENTIATION_GENERAL:
3598
2.38M
        mxSaveState;
3599
2.38M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._exp))
3600
2.35M
          slot->value.number = fx_pow(slot->value.number, mxStack->value.number);
3601
2.38M
        mxRestoreState;
3602
2.38M
      }
3603
4.44M
      mxFloatingPointOp("exponent");
3604
4.44M
      mxStack++;
3605
4.44M
      mxNextCode(1);
3606
4.44M
      mxBreak;
3607
4.44M
    mxCase(XS_CODE_MULTIPLY)
3608
2.69M
      slot = mxStack + 1;
3609
2.69M
      if (slot->kind == XS_INTEGER_KIND) {
3610
1.42M
        if (mxStack->kind == XS_INTEGER_KIND) {
3611
777k
        #ifdef mxMinusZero
3612
777k
          if (slot->value.integer == 0) {
3613
346k
            if (mxStack->value.integer < 0) {
3614
4.26k
              slot->kind = XS_NUMBER_KIND;
3615
4.26k
              slot->value.number = -0.0;
3616
4.26k
            }
3617
346k
          }
3618
431k
          else if (mxStack->value.integer == 0) {
3619
20.5k
            if (slot->value.integer < 0) {
3620
3.95k
              slot->kind = XS_NUMBER_KIND;
3621
3.95k
              slot->value.number = -0.0;
3622
3.95k
            }
3623
16.6k
            else
3624
16.6k
              slot->value.integer = 0;
3625
20.5k
          }
3626
410k
          else {
3627
410k
        #endif
3628
410k
          #if __has_builtin(__builtin_mul_overflow)
3629
410k
            if (__builtin_mul_overflow(slot->value.integer, mxStack->value.integer, &scratch.value.integer)) {
3630
140k
              slot->kind = XS_NUMBER_KIND;
3631
140k
              slot->value.number = (txNumber)(slot->value.integer) * (txNumber)(mxStack->value.integer);
3632
140k
              mxFloatingPointOp("multiply");
3633
140k
            }
3634
270k
            else
3635
270k
              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
410k
        #ifdef mxMinusZero
3642
410k
          }
3643
777k
        #endif
3644
777k
        }
3645
650k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3646
349k
          slot->kind = XS_NUMBER_KIND;
3647
349k
          slot->value.number = (txNumber)(slot->value.integer) * mxStack->value.number;
3648
349k
          mxFloatingPointOp("multiply");
3649
349k
        }
3650
301k
        else
3651
301k
          goto XS_CODE_MULTIPLY_GENERAL;
3652
1.42M
      }
3653
1.26M
      else if (slot->kind == XS_NUMBER_KIND) {
3654
1.13M
        if (mxStack->kind == XS_INTEGER_KIND) {
3655
378k
          slot->value.number *= (txNumber)(mxStack->value.integer);
3656
378k
          mxFloatingPointOp("multiply");
3657
378k
        }
3658
757k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3659
459k
          slot->value.number *= mxStack->value.number;
3660
459k
          mxFloatingPointOp("multiply");
3661
459k
        }
3662
298k
        else
3663
298k
          goto XS_CODE_MULTIPLY_GENERAL;
3664
1.13M
      }
3665
128k
      else {
3666
728k
    XS_CODE_MULTIPLY_GENERAL:
3667
728k
        mxSaveState;
3668
728k
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._mul))
3669
663k
          slot->value.number *= mxStack->value.number;
3670
728k
        mxRestoreState;
3671
728k
      }
3672
2.69M
      mxStack++;
3673
2.69M
      mxNextCode(1);
3674
2.69M
      mxBreak;
3675
7.70M
    mxCase(XS_CODE_MODULO)
3676
7.70M
      slot = mxStack + 1;
3677
7.70M
      if (slot->kind == XS_INTEGER_KIND) {
3678
3.63M
        if (mxStack->kind == XS_INTEGER_KIND) {
3679
3.10M
          if (mxStack->value.integer == 0) {
3680
696k
            slot->kind = XS_NUMBER_KIND;
3681
696k
            slot->value.number = C_NAN;
3682
696k
          }
3683
2.40M
        #if mxIntegerDivideOverflowException
3684
2.40M
          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.40M
        #endif 
3689
2.40M
        #ifdef mxMinusZero
3690
2.40M
          else if (slot->value.integer < 0) {
3691
259k
            slot->value.integer %= mxStack->value.integer;
3692
259k
            if (slot->value.integer == 0) {
3693
4.11k
              slot->kind = XS_NUMBER_KIND;
3694
4.11k
              slot->value.number = -0.0;
3695
4.11k
            }
3696
259k
          }
3697
2.15M
        #endif
3698
2.15M
          else
3699
2.15M
            slot->value.integer %= mxStack->value.integer;
3700
3.10M
        }
3701
526k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3702
464k
          slot->kind = XS_NUMBER_KIND;
3703
464k
          slot->value.number = c_fmod((txNumber)(slot->value.integer), mxStack->value.number);
3704
464k
          mxFloatingPointOp("modulo");
3705
464k
        }
3706
61.6k
        else
3707
61.6k
          goto XS_CODE_MODULO_GENERAL;
3708
3.63M
      }
3709
4.06M
      else if (slot->kind == XS_NUMBER_KIND) {
3710
2.01M
        if (mxStack->kind == XS_INTEGER_KIND) {
3711
571k
          slot->value.number = c_fmod(slot->value.number, (txNumber)(mxStack->value.integer));
3712
571k
          mxFloatingPointOp("modulo");
3713
571k
        }
3714
1.44M
        else if (mxStack->kind == XS_NUMBER_KIND) {
3715
923k
          slot->value.number = c_fmod(slot->value.number, mxStack->value.number);
3716
923k
          mxFloatingPointOp("modulo");
3717
923k
        }
3718
517k
        else
3719
517k
          goto XS_CODE_MODULO_GENERAL;
3720
2.01M
      }
3721
2.05M
      else {
3722
2.63M
    XS_CODE_MODULO_GENERAL:
3723
2.63M
        mxSaveState;
3724
2.63M
        if (fxToNumericNumberBinary(the, slot, mxStack, gxTypeBigInt._rem)) {
3725
1.92M
          slot->value.number = c_fmod(slot->value.number, mxStack->value.number);
3726
1.92M
          mxFloatingPointOp("modulo");
3727
1.92M
        }
3728
2.63M
        mxRestoreState;
3729
2.63M
      }
3730
7.70M
      mxStack++;
3731
7.70M
      mxNextCode(1);
3732
7.70M
      mxBreak;
3733
      
3734
7.70M
    mxCase(XS_CODE_NOT)
3735
6.74M
      mxToBoolean(mxStack);
3736
6.74M
      mxStack->value.boolean = !mxStack->value.boolean;
3737
6.74M
      mxNextCode(1);
3738
6.74M
      mxBreak;
3739
18.3M
    mxCase(XS_CODE_LESS)
3740
18.3M
      slot = mxStack + 1;
3741
18.3M
      if (slot->kind == XS_INTEGER_KIND) {
3742
13.0M
        if (mxStack->kind == XS_INTEGER_KIND)
3743
10.3M
          offset = slot->value.integer < mxStack->value.integer;
3744
2.71M
        else if (mxStack->kind == XS_NUMBER_KIND)  {
3745
1.43M
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) < mxStack->value.number);
3746
1.43M
          mxFloatingPointOp("less");
3747
1.43M
        }
3748
1.27M
        else
3749
1.27M
          goto XS_CODE_LESS_GENERAL;
3750
13.0M
      }
3751
5.32M
      else if (slot->kind == XS_NUMBER_KIND) {
3752
2.33M
        if (mxStack->kind == XS_INTEGER_KIND) {
3753
1.59M
          offset = (!c_isnan(slot->value.number)) && (slot->value.number < (txNumber)(mxStack->value.integer));
3754
1.59M
          mxFloatingPointOp("less");
3755
1.59M
        }
3756
744k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3757
253k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number < mxStack->value.number);
3758
253k
          mxFloatingPointOp("less");
3759
253k
        }
3760
491k
        else
3761
491k
          goto XS_CODE_LESS_GENERAL;
3762
2.33M
      }
3763
2.98M
      else {
3764
4.75M
    XS_CODE_LESS_GENERAL:
3765
4.75M
        mxSaveState; 
3766
4.75M
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3767
4.75M
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3768
4.75M
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3769
73.4k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) < 0;
3770
4.68M
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3771
1.82M
          offset = gxTypeBigInt.compare(the, 1, 0, 0, slot, mxStack);
3772
2.85M
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3773
1.66M
          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
4.75M
        mxRestoreState;
3781
4.75M
      }
3782
18.3M
      slot->kind = XS_BOOLEAN_KIND;
3783
18.3M
      slot->value.boolean = offset;
3784
18.3M
      mxStack++;
3785
18.3M
      mxNextCode(1);
3786
18.3M
      mxBreak;
3787
18.3M
    mxCase(XS_CODE_LESS_EQUAL)
3788
1.11M
      slot = mxStack + 1;
3789
1.11M
      if (slot->kind == XS_INTEGER_KIND) {
3790
870k
        if (mxStack->kind == XS_INTEGER_KIND)
3791
669k
          offset = slot->value.integer <= mxStack->value.integer;
3792
201k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3793
75.2k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) <= mxStack->value.number);
3794
75.2k
          mxFloatingPointOp("less or equal");
3795
75.2k
        }
3796
125k
        else
3797
125k
          goto XS_CODE_LESS_EQUAL_GENERAL;
3798
870k
      }
3799
246k
      else if (slot->kind == XS_NUMBER_KIND) {
3800
192k
        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
83.3k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3805
78.9k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number <= mxStack->value.number);
3806
78.9k
          mxFloatingPointOp("less or equal");
3807
78.9k
        }
3808
4.42k
        else
3809
4.42k
          goto XS_CODE_LESS_EQUAL_GENERAL;
3810
192k
      }
3811
53.7k
      else {
3812
184k
    XS_CODE_LESS_EQUAL_GENERAL:
3813
184k
        mxSaveState; 
3814
184k
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3815
184k
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3816
184k
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3817
3.49k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) <= 0;
3818
180k
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3819
153
          offset = gxTypeBigInt.compare(the, 1, 1, 0, slot, mxStack);
3820
180k
        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
99.0k
        else {
3823
99.0k
          fxToNumber(the, slot);
3824
99.0k
          fxToNumber(the, mxStack);
3825
99.0k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number <= mxStack->value.number);
3826
99.0k
          mxFloatingPointOp("less or equal");
3827
99.0k
        }
3828
184k
        mxRestoreState;
3829
184k
      }
3830
1.11M
      slot->kind = XS_BOOLEAN_KIND;
3831
1.11M
      slot->value.boolean = offset;
3832
1.11M
      mxStack++;
3833
1.11M
      mxNextCode(1);
3834
1.11M
      mxBreak;
3835
1.79M
    mxCase(XS_CODE_MORE)
3836
1.79M
      slot = mxStack + 1;
3837
1.79M
      if (slot->kind == XS_INTEGER_KIND) {
3838
1.18M
        if (mxStack->kind == XS_INTEGER_KIND)
3839
972k
          offset = slot->value.integer > mxStack->value.integer;
3840
217k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3841
156k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) > mxStack->value.number);
3842
156k
          mxFloatingPointOp("more");
3843
156k
        }
3844
61.4k
        else
3845
61.4k
          goto XS_CODE_MORE_GENERAL;
3846
1.18M
      }
3847
601k
      else if (slot->kind == XS_NUMBER_KIND) {
3848
235k
        if (mxStack->kind == XS_INTEGER_KIND) {
3849
108k
          offset = (!c_isnan(slot->value.number)) && (slot->value.number > (txNumber)(mxStack->value.integer));
3850
108k
          mxFloatingPointOp("more");
3851
108k
        }
3852
126k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3853
52.9k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number > mxStack->value.number);
3854
52.9k
          mxFloatingPointOp("more");
3855
52.9k
        }
3856
73.9k
        else
3857
73.9k
          goto XS_CODE_MORE_GENERAL;
3858
235k
      }
3859
366k
      else {
3860
501k
    XS_CODE_MORE_GENERAL:
3861
501k
        mxSaveState; 
3862
501k
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3863
501k
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3864
501k
        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.69k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) > 0;
3866
498k
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3867
1.41k
          offset = gxTypeBigInt.compare(the, 0, 0, 1, slot, mxStack);
3868
497k
        else if ((mxStack->kind == XS_BIGINT_KIND) || (mxStack->kind == XS_BIGINT_X_KIND))
3869
2.46k
          offset = gxTypeBigInt.compare(the, 1, 0, 0, mxStack, slot);
3870
494k
        else {
3871
494k
          fxToNumber(the, slot);
3872
494k
          fxToNumber(the, mxStack);
3873
494k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number > mxStack->value.number);
3874
494k
          mxFloatingPointOp("more");
3875
494k
        }
3876
501k
        mxRestoreState;
3877
501k
      }
3878
1.79M
      slot->kind = XS_BOOLEAN_KIND;
3879
1.79M
      slot->value.boolean = offset;
3880
1.79M
      mxStack++;
3881
1.79M
      mxNextCode(1);
3882
1.79M
      mxBreak;
3883
2.66M
    mxCase(XS_CODE_MORE_EQUAL)
3884
2.66M
      slot = mxStack + 1;
3885
2.66M
      if (slot->kind == XS_INTEGER_KIND) {
3886
872k
        if (mxStack->kind == XS_INTEGER_KIND)
3887
514k
          offset = slot->value.integer >= mxStack->value.integer;
3888
358k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3889
223k
          offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) >= mxStack->value.number);
3890
223k
          mxFloatingPointOp("more or equal");
3891
223k
        }
3892
134k
        else
3893
134k
          goto XS_CODE_MORE_EQUAL_GENERAL;
3894
872k
      }
3895
1.79M
      else if (slot->kind == XS_NUMBER_KIND) {
3896
1.14M
        if (mxStack->kind == XS_INTEGER_KIND) {
3897
447k
          offset = (!c_isnan(slot->value.number)) && (slot->value.number >= (txNumber)(mxStack->value.integer));
3898
447k
          mxFloatingPointOp("more or equal");
3899
447k
        }
3900
695k
        else if (mxStack->kind == XS_NUMBER_KIND) {
3901
458k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number >= mxStack->value.number);
3902
458k
          mxFloatingPointOp("more or equal");
3903
458k
        }
3904
237k
        else
3905
237k
          goto XS_CODE_MORE_EQUAL_GENERAL;
3906
1.14M
      }
3907
652k
      else {
3908
1.02M
    XS_CODE_MORE_EQUAL_GENERAL:
3909
1.02M
        mxSaveState; 
3910
1.02M
        fxToPrimitive(the, slot, XS_NUMBER_HINT); 
3911
1.02M
        fxToPrimitive(the, mxStack, XS_NUMBER_HINT); 
3912
1.02M
        if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND)))
3913
1.12k
          offset = fxUTF8Compare(slot->value.string, mxStack->value.string) >= 0;
3914
1.02M
        else if ((slot->kind == XS_BIGINT_KIND) || (slot->kind == XS_BIGINT_X_KIND))
3915
13.7k
          offset = gxTypeBigInt.compare(the, 0, 1, 1, slot, mxStack);
3916
1.00M
        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.00M
        else {
3919
1.00M
          fxToNumber(the, slot);
3920
1.00M
          fxToNumber(the, mxStack);
3921
1.00M
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number >= mxStack->value.number);
3922
1.00M
          mxFloatingPointOp("more or equal");
3923
1.00M
        }
3924
1.02M
        mxRestoreState;
3925
1.02M
      }
3926
2.66M
      slot->kind = XS_BOOLEAN_KIND;
3927
2.66M
      slot->value.boolean = offset;
3928
2.66M
      mxStack++;
3929
2.66M
      mxNextCode(1);
3930
2.66M
      mxBreak;
3931
3932
2.66M
    mxCase(XS_CODE_EQUAL)
3933
1.54M
    mxCase(XS_CODE_STRICT_EQUAL)
3934
1.54M
      slot = mxStack + 1;
3935
1.57M
    XS_CODE_EQUAL_AGAIN:
3936
1.57M
      if (slot->kind == mxStack->kind) {
3937
542k
        if ((XS_UNDEFINED_KIND == slot->kind) || (XS_NULL_KIND == slot->kind))
3938
134k
          offset = 1;
3939
408k
        else if (XS_BOOLEAN_KIND == slot->kind)
3940
10.4k
          offset = slot->value.boolean == stack->value.boolean;
3941
397k
        else if (XS_INTEGER_KIND == slot->kind)
3942
248k
          offset = slot->value.integer == stack->value.integer;
3943
149k
        else if (XS_NUMBER_KIND == slot->kind) {
3944
24.9k
          offset = (!c_isnan(slot->value.number)) && (!c_isnan(mxStack->value.number)) && (slot->value.number == mxStack->value.number);
3945
24.9k
          mxFloatingPointOp("equal");
3946
24.9k
        }
3947
124k
        else if ((XS_STRING_KIND == slot->kind) || (XS_STRING_X_KIND == slot->kind))
3948
38.2k
          offset = c_strcmp(slot->value.string, mxStack->value.string) == 0;
3949
86.1k
        else if (XS_SYMBOL_KIND == slot->kind)
3950
1.33k
          offset = slot->value.symbol == mxStack->value.symbol;
3951
84.7k
        else if (XS_REFERENCE_KIND == slot->kind)
3952
84.5k
          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
542k
      }
3962
1.03M
      else if ((XS_INTEGER_KIND == slot->kind) && (XS_NUMBER_KIND == mxStack->kind)) {
3963
7.26k
        offset = (!c_isnan(mxStack->value.number)) && ((txNumber)(slot->value.integer) == stack->value.number);
3964
7.26k
        mxFloatingPointOp("equal");
3965
7.26k
      }
3966
1.02M
      else if ((XS_NUMBER_KIND == slot->kind) && (XS_INTEGER_KIND == mxStack->kind)) {
3967
2.91k
        offset = (!c_isnan(slot->value.number)) && (slot->value.number == (txNumber)(mxStack->value.integer));
3968
2.91k
        mxFloatingPointOp("equal");
3969
2.91k
      }
3970
1.02M
      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.02M
      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.02M
      else if (XS_CODE_EQUAL == byte) {
3975
369k
        if ((slot->kind == XS_UNDEFINED_KIND) && (mxStack->kind == XS_NULL_KIND))
3976
1
          offset = 1;
3977
369k
        else if ((slot->kind == XS_NULL_KIND) && (mxStack->kind == XS_UNDEFINED_KIND))
3978
3
          offset = 1;
3979
369k
        else if (((XS_INTEGER_KIND == slot->kind) || (XS_NUMBER_KIND == slot->kind)) && ((mxStack->kind == XS_STRING_KIND) || (mxStack->kind == XS_STRING_X_KIND))) {
3980
1.97k
          mxToNumber(mxStack); 
3981
1.97k
          goto XS_CODE_EQUAL_AGAIN;
3982
1.97k
        }
3983
367k
        else if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_INTEGER_KIND == mxStack->kind) || (XS_NUMBER_KIND == mxStack->kind))) {
3984
1.74k
          mxToNumber(slot);
3985
1.74k
          goto XS_CODE_EQUAL_AGAIN;
3986
1.74k
        }
3987
365k
        else if (XS_BOOLEAN_KIND == slot->kind) {
3988
18.3k
          mxToNumber(slot);
3989
18.3k
          goto XS_CODE_EQUAL_AGAIN;
3990
18.3k
        }
3991
347k
        else if (XS_BOOLEAN_KIND == mxStack->kind) {
3992
2.16k
          mxToNumber(mxStack);
3993
2.16k
          goto XS_CODE_EQUAL_AGAIN;
3994
2.16k
        }
3995
344k
        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
745
          mxSaveState;
3997
745
          fxToPrimitive(the, mxStack, XS_NO_HINT);
3998
745
          mxRestoreState;
3999
745
          goto XS_CODE_EQUAL_AGAIN;
4000
745
        }
4001
344k
        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
4.78k
          mxSaveState;
4003
4.78k
          fxToPrimitive(the, slot, XS_NO_HINT);
4004
4.78k
          mxRestoreState;
4005
4.78k
          goto XS_CODE_EQUAL_AGAIN;
4006
4.78k
        }
4007
339k
        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
547
          mxSaveState;
4009
547
          offset = gxTypeBigInt.compare(the, 0, 1, 0, slot, mxStack);
4010
547
          mxRestoreState;
4011
547
        }
4012
338k
        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.10k
          mxSaveState;
4014
1.10k
          offset = gxTypeBigInt.compare(the, 0, 1, 0, mxStack, slot);
4015
1.10k
          mxRestoreState;
4016
1.10k
        }
4017
337k
                else
4018
337k
                    offset = 0;
4019
369k
      }
4020
652k
      else 
4021
652k
        offset = 0;
4022
1.54M
      slot->kind = XS_BOOLEAN_KIND;
4023
1.54M
      slot->value.boolean = offset;
4024
1.54M
      mxStack++;
4025
1.54M
      mxNextCode(1);
4026
1.54M
      mxBreak;
4027
3.21M
    mxCase(XS_CODE_NOT_EQUAL)
4028
4.33M
    mxCase(XS_CODE_STRICT_NOT_EQUAL)
4029
4.33M
      slot = mxStack + 1;
4030
4.72M
    XS_CODE_NOT_EQUAL_AGAIN:
4031
4.72M
      if (slot->kind == mxStack->kind) {
4032
1.22M
        if ((XS_UNDEFINED_KIND == slot->kind) || (XS_NULL_KIND == slot->kind))
4033
104k
          offset = 0;
4034
1.11M
        else if (XS_BOOLEAN_KIND == slot->kind)
4035
372k
          offset = slot->value.boolean != stack->value.boolean;
4036
746k
        else if (XS_INTEGER_KIND == slot->kind)
4037
419k
          offset = slot->value.integer != stack->value.integer;
4038
327k
        else if (XS_NUMBER_KIND == slot->kind) {
4039
5.64k
          offset = (c_isnan(slot->value.number)) || (c_isnan(mxStack->value.number)) || (slot->value.number != mxStack->value.number);
4040
5.64k
          mxFloatingPointOp("not equal");
4041
5.64k
        }
4042
321k
        else if ((XS_STRING_KIND == slot->kind) || (XS_STRING_X_KIND == slot->kind))
4043
318k
          offset = c_strcmp(slot->value.string, mxStack->value.string) != 0;
4044
3.66k
        else if (XS_SYMBOL_KIND == slot->kind)
4045
1.90k
          offset = slot->value.symbol != mxStack->value.symbol;
4046
1.76k
        else if (XS_REFERENCE_KIND == slot->kind)
4047
1.74k
          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
17
        else if ((XS_BIGINT_KIND == slot->kind) || (XS_BIGINT_X_KIND == slot->kind))
4053
17
          offset = gxTypeBigInt.compare(the, 1, 0, 1, slot, mxStack);
4054
0
                else
4055
0
                  offset = 1;
4056
1.22M
      }
4057
3.50M
      else if ((XS_INTEGER_KIND == slot->kind) && (XS_NUMBER_KIND == mxStack->kind)) {
4058
345k
        offset = (c_isnan(mxStack->value.number)) || ((txNumber)(slot->value.integer) != stack->value.number);
4059
345k
        mxFloatingPointOp("not equal");
4060
345k
      }
4061
3.15M
      else if ((XS_NUMBER_KIND == slot->kind) && (XS_INTEGER_KIND == mxStack->kind)) {
4062
367k
        offset = (c_isnan(slot->value.number)) || (slot->value.number != (txNumber)(mxStack->value.integer));
4063
367k
        mxFloatingPointOp("not equal");
4064
367k
      }
4065
2.79M
      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.79M
      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.79M
      else if (XS_CODE_NOT_EQUAL == byte) {
4070
2.59M
        if ((slot->kind == XS_UNDEFINED_KIND) && (mxStack->kind == XS_NULL_KIND))
4071
116k
          offset = 0;
4072
2.48M
        else if ((slot->kind == XS_NULL_KIND) && (mxStack->kind == XS_UNDEFINED_KIND))
4073
1.45k
          offset = 0;
4074
2.47M
        else if (((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && ((XS_INTEGER_KIND == mxStack->kind) || (XS_NUMBER_KIND == mxStack->kind))) {
4075
12.1k
          mxToNumber(slot);
4076
12.1k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4077
12.1k
        }
4078
2.46M
        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.37M
        else if (XS_BOOLEAN_KIND == slot->kind) {
4083
65.4k
          mxToNumber(slot);
4084
65.4k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4085
65.4k
        }
4086
2.30M
        else if (XS_BOOLEAN_KIND == mxStack->kind) {
4087
81.3k
          mxToNumber(mxStack);
4088
81.3k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4089
81.3k
        }
4090
2.22M
        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
95.1k
          mxSaveState;
4092
95.1k
          fxToPrimitive(the, mxStack, XS_NO_HINT);
4093
95.1k
          mxRestoreState;
4094
95.1k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4095
95.1k
        }
4096
2.13M
        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
45.1k
          mxSaveState;
4098
45.1k
          fxToPrimitive(the, slot, XS_NO_HINT);
4099
45.1k
          mxRestoreState;
4100
45.1k
          goto XS_CODE_NOT_EQUAL_AGAIN;
4101
45.1k
        }
4102
2.08M
        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.19M
          mxSaveState;
4104
1.19M
          offset = gxTypeBigInt.compare(the, 1, 0, 1, slot, mxStack);
4105
1.19M
          mxRestoreState;
4106
1.19M
        }
4107
890k
        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
42
          mxSaveState;
4109
42
          offset = gxTypeBigInt.compare(the, 1, 0, 1, mxStack, slot);
4110
42
          mxRestoreState;
4111
42
        }
4112
890k
                else
4113
890k
                offset = 1;
4114
2.59M
      }
4115
193k
      else 
4116
193k
        offset = 1;
4117
4.33M
      slot->kind = XS_BOOLEAN_KIND;
4118
4.33M
      slot->value.boolean = offset;
4119
4.33M
      mxStack++;
4120
4.33M
      mxNextCode(1);
4121
4.33M
      mxBreak;
4122
      
4123
4.33M
    mxCase(XS_CODE_FOR_AWAIT_OF)
4124
13
      mxNextCode(1);
4125
13
      mxSaveState;
4126
13
      gxDefaults.runForAwaitOf(the);
4127
13
      mxRestoreState;
4128
13
      mxBreak;
4129
457k
    mxCase(XS_CODE_FOR_IN)
4130
457k
      mxSkipCode(1);
4131
      /* FUNCTION */
4132
457k
      mxAllocStack(1);
4133
457k
      *mxStack = mxEnumeratorFunction;
4134
457k
      slot = fxGetInstance(the, mxStack);
4135
      /* RESULT */
4136
457k
      mxPushKind(XS_UNDEFINED_KIND);
4137
457k
      mxPushKind(XS_UNDEFINED_KIND);
4138
457k
      offset = 0;
4139
457k
      goto XS_CODE_RUN_ALL;
4140
4141
73.6k
    mxCase(XS_CODE_FOR_OF)
4142
73.6k
      mxNextCode(1);
4143
73.6k
      mxSaveState;
4144
73.6k
      fxRunForOf(the);
4145
73.6k
      mxRestoreState;
4146
73.6k
      mxBreak;
4147
      
4148
73.6k
    mxCase(XS_CODE_IN)
4149
41.7k
      mxNextCode(1);
4150
41.7k
      if (!mxIsReference(mxStack))
4151
41.4k
        mxRunDebug(XS_TYPE_ERROR, "in: not an object");
4152
41.4k
      mxSaveState;
4153
41.4k
      fxRunIn(the);
4154
41.4k
      mxRestoreState;
4155
41.4k
      mxBreak;
4156
168k
    mxCase(XS_CODE_INSTANCEOF)
4157
168k
      mxNextCode(1);
4158
168k
      mxSaveState;
4159
168k
      fxRunInstanceOf(the);
4160
168k
      mxRestoreState;
4161
168k
      mxBreak;
4162
1.29M
    mxCase(XS_CODE_TYPEOF)
4163
1.29M
      byte = mxStack->kind;
4164
1.29M
      if (XS_UNDEFINED_KIND == byte)
4165
375k
        *mxStack = mxUndefinedString;
4166
921k
      else if (XS_NULL_KIND == byte)
4167
32
        *mxStack = mxObjectString;
4168
921k
      else if (XS_BOOLEAN_KIND == byte)
4169
595k
        *mxStack = mxBooleanString;
4170
326k
      else if ((XS_INTEGER_KIND == byte) || (XS_NUMBER_KIND == byte))
4171
90.2k
        *mxStack = mxNumberString;
4172
236k
      else if ((XS_STRING_KIND == byte) || (XS_STRING_X_KIND == byte))
4173
467
        *mxStack = mxStringString;
4174
235k
      else if (XS_SYMBOL_KIND == byte)
4175
21
        *mxStack = mxSymbolString;
4176
235k
      else if ((XS_BIGINT_KIND == byte) || (XS_BIGINT_X_KIND == byte))
4177
746
        *mxStack = mxBigIntString;
4178
234k
      else if (XS_REFERENCE_KIND == byte) {
4179
234k
        slot = fxGetInstance(the, mxStack);
4180
234k
        if (slot->flag & XS_CAN_CALL_FLAG)
4181
73.4k
          *mxStack = mxFunctionString;
4182
161k
        else
4183
161k
          *mxStack = mxObjectString;
4184
234k
      }
4185
    #if mxHostFunctionPrimitive
4186
      else if (XS_HOST_FUNCTION_KIND == byte)
4187
        *mxStack = mxFunctionString;
4188
    #endif
4189
1.29M
      mxNextCode(1);
4190
1.29M
      mxBreak;
4191
1.29M
    mxCase(XS_CODE_VOID)
4192
156k
      mxNextCode(1);
4193
156k
      mxStack->kind = XS_UNDEFINED_KIND;
4194
156k
      mxBreak;
4195
4196
  /* DEBUG */    
4197
156k
    mxCase(XS_CODE_DEBUGGER)
4198
2.72k
      mxNextCode(1);
4199
2.72k
    #ifdef mxDebug
4200
2.72k
      if (!the->debugEval) {
4201
2.72k
        mxSaveState;
4202
2.72k
        fxDebugLoop(the, C_NULL, 0, "debugger");
4203
2.72k
        mxRestoreState;
4204
2.72k
      }
4205
2.72k
    #endif
4206
2.72k
      mxBreak;
4207
8.02M
    mxCase(XS_CODE_FILE)
4208
8.02M
    #ifdef mxDebug
4209
8.02M
      count = mxRunID(1);
4210
#ifdef mxTrace
4211
      if (gxDoTrace) fxTraceID(the, count, 0);
4212
#endif
4213
8.02M
      mxEnvironment->ID = count;
4214
8.02M
      mxEnvironment->value.environment.line = 0;
4215
8.02M
    #endif
4216
8.02M
      mxNextCode(1 + sizeof(txID));
4217
8.02M
      mxBreak;
4218
97.4M
    mxCase(XS_CODE_LINE)
4219
97.4M
    #ifdef mxDebug
4220
97.4M
      count = mxRunS2(1);
4221
#ifdef mxTrace
4222
      if (gxDoTrace) fxTraceInteger(the, count);
4223
#endif
4224
97.4M
      if (count == 0) {
4225
8.54M
        count = mxFunctionInstanceCode(mxFrameFunction->value.reference)->ID;
4226
8.54M
        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
8.54M
      }
4232
88.8M
      else {
4233
88.8M
        mxEnvironment->value.environment.line = count;
4234
88.8M
        if (fxIsReadable(the)) {
4235
0
          mxSaveState;
4236
0
          fxDebugCommand(the);
4237
0
          mxRestoreState;
4238
0
        }
4239
88.8M
        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
88.8M
      }
4245
97.4M
    #endif
4246
97.4M
    #if defined(mxInstrument) || defined(mxProfile)
4247
97.4M
      fxCheckProfiler(the, mxFrame);
4248
97.4M
    #endif
4249
97.4M
      mxNextCode(3);
4250
97.4M
      mxBreak;
4251
4252
  /* MODULE */    
4253
97.4M
    mxCase(XS_CODE_IMPORT)
4254
16.2k
      slot = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4255
16.2k
      variable = mxModuleInstanceInternal(slot);
4256
16.2k
      variable = variable->value.module.realm;
4257
16.2k
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4258
16.2k
      mxSaveState;
4259
16.2k
      gxDefaults.runImport(the, variable, slot);
4260
16.2k
      mxRestoreState;
4261
16.2k
      mxNextCode(1);
4262
16.2k
      mxBreak;
4263
16.2k
    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
1.02k
    mxCase(XS_CODE_TRANSFER)
4271
1.02k
      mxSaveState;
4272
1.02k
      fxPrepareTransfer(the, XS_NO_FLAG);
4273
1.02k
      mxRestoreState;
4274
1.02k
            mxNextCode(1);
4275
1.02k
      mxBreak;
4276
1.02k
    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
933
    mxCase(XS_CODE_MODULE)
4283
933
      byte = mxRunU1(1);
4284
933
      mxSaveState;
4285
933
      fxPrepareModule(the, byte);
4286
933
      mxRestoreState;
4287
933
            mxNextCode(2);
4288
933
      mxBreak;
4289
      
4290
  /* EVAL, PROGRAM & WITH */
4291
436k
    mxCase(XS_CODE_EVAL)
4292
436k
      offset = mxStack->value.integer;
4293
436k
      slot = mxStack + 1 + offset + 2;
4294
436k
      if (mxIsReference(slot) && mxIsFunction(slot->value.reference) && (mxFunctionInstanceCode(slot->value.reference)->value.callback.address == mxFunctionInstanceCode(mxEvalFunction.value.reference)->value.callback.address)) {
4295
435k
        mxSaveState;
4296
435k
        gxDefaults.runEval(the);
4297
435k
        mxRestoreState;
4298
435k
        mxNextCode(1);
4299
435k
        mxBreak;
4300
435k
      }
4301
436k
      mxSkipCode(1);
4302
436k
      mxStack++;
4303
436k
      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
110k
    mxCase(XS_CODE_EVAL_ENVIRONMENT)
4318
110k
      mxNextCode(1);
4319
110k
      mxSaveState;
4320
110k
      gxDefaults.runEvalEnvironment(the);
4321
110k
      mxRestoreState;
4322
110k
      mxBreak;
4323
110k
    mxCase(XS_CODE_EVAL_PRIVATE)
4324
258
      offset = mxRunID(1);
4325
    #ifdef mxTrace
4326
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4327
    #endif
4328
258
      mxNextCode(1 + sizeof(txID));
4329
258
      variable = mxEnvironment;
4330
258
      if (variable->kind == XS_REFERENCE_KIND) {
4331
258
        variable = variable->value.reference;
4332
2.58k
    XS_CODE_EVAL_PRIVATE_AGAIN:
4333
2.58k
        if (variable) {
4334
2.32k
          slot = mxBehaviorGetProperty(the, variable, (txID)offset, 0, XS_OWN);
4335
2.32k
          if (slot) {
4336
0
            mxPushKind(slot->kind);
4337
0
            mxStack->value = slot->value;
4338
0
            mxBreak;
4339
0
          }
4340
2.32k
          variable = variable->value.instance.prototype;
4341
2.32k
          goto XS_CODE_EVAL_PRIVATE_AGAIN;
4342
2.32k
        }
4343
2.58k
      }
4344
258
      mxRunDebugID(XS_SYNTAX_ERROR, "eval %s: undefined private property", (txID)offset);
4345
0
      mxBreak;
4346
4.64M
    mxCase(XS_CODE_EVAL_REFERENCE)
4347
4.64M
      offset = mxRunID(1);
4348
    #ifdef mxTrace
4349
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4350
    #endif
4351
4.64M
      mxNextCode(1 + sizeof(txID));
4352
4.64M
      variable = mxEnvironment;
4353
4.64M
      if (variable->kind == XS_REFERENCE_KIND) {
4354
4.64M
        variable = variable->value.reference;
4355
14.3M
    XS_CODE_EVAL_REFERENCE_AGAIN:
4356
14.3M
        if (variable->value.instance.prototype) {
4357
10.3M
          slot = variable->next;
4358
10.3M
          if (slot->kind == XS_REFERENCE_KIND) {
4359
3.65M
            slot = slot->value.reference;
4360
3.65M
            mxSaveState;
4361
3.65M
            index = fxIsScopableSlot(the, slot, (txID)offset);
4362
3.65M
            mxRestoreState;
4363
3.65M
            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
3.65M
          }
4375
6.66M
          else if (mxBehaviorHasProperty(the, variable, (txID)offset, 0)) {
4376
402k
            mxPushKind(XS_REFERENCE_KIND);
4377
402k
            mxStack->value.reference = variable;
4378
402k
            mxBreak;
4379
402k
          }
4380
10.3M
          variable = variable->value.instance.prototype;
4381
10.3M
          goto XS_CODE_EVAL_REFERENCE_AGAIN;
4382
10.3M
        }
4383
3.99M
        if (mxBehaviorHasProperty(the, variable, (txID)offset, 0)) {
4384
2.40k
          mxPushKind(XS_REFERENCE_KIND);
4385
2.40k
          mxStack->value.reference = variable;
4386
2.40k
          mxBreak;
4387
2.40k
        }
4388
3.99M
      }
4389
7.99M
      mxPushKind(XS_REFERENCE_KIND);
4390
7.99M
      variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4391
7.99M
      variable = mxModuleInstanceInternal(variable)->value.module.realm;
4392
7.99M
      if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4393
7.99M
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
4394
7.99M
      mxBreak;
4395
7.99M
    mxCase(XS_CODE_FUNCTION_ENVIRONMENT)  
4396
423k
      variable = mxEnvironment;
4397
423k
      mxPushKind(XS_UNDEFINED_KIND);
4398
423k
      mxSaveState;
4399
423k
      slot = fxNewEnvironmentInstance(the, variable);
4400
423k
      mxRestoreState;
4401
423k
      variable = mxFunctionInstanceCode((mxStack + 1)->value.reference);
4402
423k
      variable->value.code.closures = slot;
4403
423k
      mxNextCode(1);
4404
423k
      mxBreak;
4405
423k
    mxCase(XS_CODE_PROGRAM_ENVIRONMENT)
4406
13.4k
      mxNextCode(1);
4407
13.4k
      mxSaveState;
4408
13.4k
      gxDefaults.runProgramEnvironment(the);
4409
13.4k
      mxRestoreState;
4410
13.4k
      mxBreak;
4411
127M
    mxCase(XS_CODE_PROGRAM_REFERENCE)
4412
127M
      offset = mxRunID(1);
4413
    #ifdef mxTrace
4414
      if (gxDoTrace) fxTraceID(the, (txID)offset, 0);
4415
    #endif
4416
127M
      mxNextCode(1 + sizeof(txID));
4417
127M
            variable = mxFunctionInstanceHome(mxFrameFunction->value.reference)->value.home.module;
4418
127M
            variable = mxModuleInstanceInternal(variable)->value.module.realm;
4419
127M
            if (!variable) variable = mxModuleInstanceInternal(mxProgram.value.reference)->value.module.realm;
4420
127M
            slot = mxRealmClosures(variable)->value.reference;
4421
127M
            if (mxBehaviorHasProperty(the, slot, (txID)offset, 0)) {
4422
38
                mxPushKind(XS_REFERENCE_KIND);
4423
38
                mxStack->value.reference = slot;
4424
38
                mxBreak;
4425
38
            }
4426
254M
      mxPushKind(XS_REFERENCE_KIND);
4427
254M
      mxStack->value.reference = mxRealmGlobal(variable)->value.reference;
4428
254M
      mxBreak;
4429
254M
    mxCase(XS_CODE_WITH)
4430
1.86M
      variable = mxEnvironment;
4431
1.86M
      mxSaveState;
4432
1.86M
      slot = fxNewEnvironmentInstance(the, variable);
4433
1.86M
      mxRestoreState;
4434
1.86M
      variable->kind = XS_REFERENCE_KIND;
4435
1.86M
      variable->value.reference = slot;
4436
1.86M
      mxNextCode(1);
4437
1.86M
      mxBreak;
4438
1.86M
    mxCase(XS_CODE_WITHOUT)
4439
66.3k
      variable = mxEnvironment;
4440
66.3k
      slot = variable->value.reference->value.instance.prototype;
4441
66.3k
      if (slot) {
4442
66.3k
        variable->kind = XS_REFERENCE_KIND;
4443
66.3k
        variable->value.reference = slot;
4444
66.3k
      }
4445
0
      else
4446
0
        variable->kind = XS_NULL_KIND;
4447
66.3k
      mxNextCode(1);
4448
66.3k
      mxBreak;
4449
66.3k
    }
4450
66.3k
  }
4451
4452
66.3k
STACK_OVERFLOW:
4453
58
  mxSaveState;
4454
58
  fxAbort(the, XS_JAVASCRIPT_STACK_OVERFLOW_EXIT);
4455
58
}
4456
4457
#ifdef mxMetering
4458
4459
void fxBeginMetering(txMachine* the, txBoolean (*callback)(txMachine*, txU8), txU8 interval)
4460
31.3k
{
4461
31.3k
  the->meterCallback = callback;
4462
31.3k
  the->meterCount = ((txU8)interval) << 16;
4463
31.3k
  the->meterIndex = 0;
4464
31.3k
  the->meterInterval = ((txU8)interval) << 16;
4465
31.3k
}
4466
4467
void fxEndMetering(txMachine* the)
4468
30.3k
{
4469
30.3k
  the->meterCallback = C_NULL;
4470
30.3k
  the->meterIndex = 0;
4471
30.3k
  the->meterInterval = 0;
4472
30.3k
  the->meterCount = 0;
4473
30.3k
}
4474
4475
void fxCheckMetering(txMachine* the)
4476
35.5k
{
4477
35.5k
  txU8 interval = the->meterInterval;
4478
35.5k
  the->meterInterval = 0;
4479
35.5k
  if ((*the->meterCallback)(the, the->meterIndex >> 16)) {
4480
34.7k
    the->meterCount = the->meterIndex + interval;
4481
34.7k
    if (the->meterCount < the->meterIndex) {
4482
0
      the->meterIndex = 0;
4483
0
      the->meterCount = interval;
4484
0
    }
4485
34.7k
    the->meterInterval = interval;
4486
34.7k
  }
4487
771
  else {
4488
771
    fxAbort(the, XS_TOO_MUCH_COMPUTATION_EXIT);
4489
771
  }
4490
35.5k
}
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.49k
    while (index < length) {
4507
5.97k
      txSlot* property = mxArgv(offset + index);
4508
5.97k
      *((txIndex*)address) = index;
4509
5.97k
      address->ID = XS_NO_ID;
4510
5.97k
      address->kind = property->kind;
4511
5.97k
      address->value = property->value;
4512
5.97k
      index++;
4513
5.97k
      address++;
4514
5.97k
    }
4515
1.52k
  }
4516
97.5k
}
4517
4518
void fxRunBase(txMachine* the)
4519
21.1k
{
4520
21.1k
  if (!mxHasTarget)
4521
126
    mxTypeError("call: class");
4522
21.0k
  fxRunConstructor(the);
4523
21.0k
}
4524
4525
void fxRunConstructor(txMachine* the)
4526
142k
{
4527
142k
  txSlot* target;
4528
142k
  txSlot* prototype;
4529
142k
  target = mxTarget;
4530
142k
  mxPushUndefined();
4531
142k
  prototype = the->stack;
4532
142k
  fxBeginHost(the);
4533
142k
  mxPushSlot(target);
4534
142k
  fxGetPrototypeFromConstructor(the, &mxObjectPrototype);
4535
142k
  *prototype = *the->stack;
4536
142k
  fxEndHost(the);
4537
142k
  fxNewHostInstance(the);
4538
142k
  mxPullSlot(mxThis);
4539
142k
}
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.2M
  else {
4548
17.2M
    fxBeginHost(the);
4549
17.2M
    mxCheck(the, instance->kind == XS_INSTANCE_KIND);
4550
17.2M
    result = mxBehaviorDefineOwnProperty(the, instance, id, index, slot, mask);
4551
17.2M
    fxEndHost(the);
4552
17.2M
  }
4553
17.3M
  return result;
4554
17.3M
}
4555
4556
4557
txBoolean fxRunDelete(txMachine* the, txSlot* instance, txID id, txIndex index) 
4558
749k
{
4559
749k
  txBoolean result;
4560
749k
  fxBeginHost(the);
4561
749k
  mxCheck(the, instance->kind == XS_INSTANCE_KIND);
4562
749k
  result = mxBehaviorDeleteProperty(the, instance, id, index);
4563
749k
  fxEndHost(the);
4564
749k
  return result;
4565
749k
}
4566
4567
void fxRunDerived(txMachine* the)
4568
227
{
4569
227
  txSlot* slot;
4570
227
  if (!mxHasTarget)
4571
4
    mxTypeError("call: class");
4572
223
  slot = fxNewSlot(the);
4573
223
  slot->kind = XS_UNINITIALIZED_KIND;
4574
223
  mxPushClosure(slot);
4575
223
  mxPullSlot(mxThis);
4576
223
}
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
435k
{ 
4608
435k
  txStringStream aStream;
4609
435k
  txUnsigned flags;
4610
435k
  txSlot* function;
4611
435k
  txSlot* home;
4612
435k
  txSlot* closures;
4613
435k
  if (the->stack->value.integer == 0)
4614
146
    the->stack->kind = XS_UNDEFINED_KIND;
4615
435k
  else
4616
435k
    the->stack += the->stack->value.integer;
4617
435k
  the->stack[4] = the->stack[0];
4618
435k
  the->stack += 4;
4619
435k
  if ((the->stack->kind == XS_STRING_KIND) || (the->stack->kind == XS_STRING_X_KIND)) {
4620
430k
    aStream.slot = the->stack;
4621
430k
    aStream.offset = 0;
4622
430k
    aStream.size = mxStringLength(fxToString(the, aStream.slot));
4623
430k
    flags = mxProgramFlag | mxEvalFlag;
4624
430k
    if (the->frame->flag & XS_STRICT_FLAG)
4625
9
      flags |= mxStrictFlag;
4626
430k
    if (the->frame->flag & XS_FIELD_FLAG)
4627
0
      flags |= mxFieldFlag;
4628
430k
    function = mxFunction->value.reference;
4629
430k
    if (function->flag & XS_CAN_CONSTRUCT_FLAG)
4630
2.95k
      flags |= mxTargetFlag;
4631
430k
    home = mxFunctionInstanceHome(function);
4632
430k
    if (home->value.home.object)
4633
0
      flags |= mxSuperFlag;
4634
430k
    closures = mxFrameToEnvironment(the->frame);
4635
430k
    if (closures->kind == XS_REFERENCE_KIND)
4636
430k
      closures = closures->value.reference;
4637
0
    else
4638
0
      closures = C_NULL;
4639
430k
    fxRunScript(the, fxParseScript(the, &aStream, fxStringGetter, flags), mxThis, mxHasTarget ? mxTarget : C_NULL, closures, home->value.home.object, home->value.home.module);
4640
430k
    aStream.slot->kind = the->stack->kind;
4641
430k
    aStream.slot->value = the->stack->value;
4642
430k
    mxPop();
4643
430k
  }
4644
435k
}
4645
4646
void fxRunForAwaitOf(txMachine* the)
4647
13
{
4648
13
  txSlot* slot = the->stack;
4649
13
  fxBeginHost(the);
4650
13
  mxPushSlot(slot);
4651
13
  mxDub();
4652
13
  mxGetID(mxID(_Symbol_asyncIterator));
4653
13
  if (mxIsUndefined(the->stack) || mxIsNull(the->stack)) {
4654
7
    mxPop();
4655
7
    mxPop();
4656
7
    fxGetIterator(the, slot, the->stack, C_NULL, 0);
4657
7
    fxNewAsyncFromSyncIteratorInstance(the);
4658
7
  }
4659
6
  else {
4660
6
    mxCall();
4661
6
    mxRunCount(0);
4662
6
  }
4663
13
  mxPullSlot(slot);
4664
13
  fxEndHost(the);
4665
13
}
4666
4667
void fxRunForOf(txMachine* the)
4668
73.6k
{
4669
73.6k
  txSlot* slot = the->stack;
4670
73.6k
  fxBeginHost(the);
4671
73.6k
  fxGetIterator(the, slot, slot, C_NULL, 0);
4672
73.6k
  fxEndHost(the);
4673
73.6k
}
4674
4675
txBoolean fxRunHas(txMachine* the, txSlot* instance, txID id, txIndex index)
4676
45.2M
{
4677
45.2M
  txBoolean result;
4678
45.2M
  fxBeginHost(the);
4679
45.2M
  result = mxBehaviorHasProperty(the, instance, id, index);
4680
45.2M
  fxEndHost(the);
4681
45.2M
  return result;
4682
45.2M
}
4683
4684
void fxRunIn(txMachine* the)
4685
41.4k
{
4686
41.4k
  txSlot* left = the->stack + 1;
4687
41.4k
  txSlot* right = the->stack;
4688
41.4k
  fxBeginHost(the);
4689
41.4k
  mxPushSlot(right);
4690
41.4k
  mxPushSlot(left);
4691
41.4k
  left->value.boolean = fxHasAt(the);
4692
41.4k
  left->kind = XS_BOOLEAN_KIND;
4693
41.4k
  fxEndHost(the);
4694
41.4k
  mxPop();
4695
41.4k
}
4696
4697
void fxRunInstanceOf(txMachine* the)
4698
168k
{
4699
168k
  txSlot* left = the->stack + 1;
4700
168k
  txSlot* right = the->stack;
4701
168k
  fxBeginHost(the);
4702
168k
  mxPushSlot(right);
4703
168k
  mxDub();
4704
168k
  mxGetID(mxID(_Symbol_hasInstance));
4705
168k
  mxCall();
4706
168k
  mxPushSlot(left);
4707
168k
  mxRunCount(1);
4708
168k
  fxToBoolean(the, the->stack);
4709
168k
  mxPullSlot(left);
4710
168k
  fxEndHost(the);
4711
168k
  mxPop();
4712
168k
}
4713
4714
void fxRunInstantiate(txMachine* the)
4715
118
{
4716
118
  if (the->stack->kind == XS_NULL_KIND) {
4717
88
    mxPop();
4718
88
    fxNewInstance(the);
4719
88
  }
4720
30
  else if (the->stack->kind == XS_REFERENCE_KIND) {
4721
29
    fxNewHostInstance(the);
4722
29
  }
4723
1
  else {
4724
1
    mxPop();
4725
1
    mxPush(mxObjectPrototype);
4726
1
    fxNewObjectInstance(the);
4727
1
  }
4728
118
}
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
202k
{ 
4761
202k
  a = a->value.reference;
4762
202k
  b = b->value.reference;
4763
202k
  if (a == b)
4764
118k
    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.1k
  return 0;
4784
202k
}
4785
4786
txBoolean fxIsSameSlot(txMachine* the, txSlot* a, txSlot* b)
4787
1.44M
{ 
4788
1.44M
  txBoolean result = 0;
4789
1.44M
  if (a->kind == b->kind) {
4790
1.34M
    if ((XS_UNDEFINED_KIND == a->kind) || (XS_NULL_KIND == a->kind))
4791
1.77k
      result = 1;
4792
1.34M
    else if (XS_BOOLEAN_KIND == a->kind)
4793
5.63k
      result = a->value.boolean == b->value.boolean;
4794
1.33M
    else if (XS_INTEGER_KIND == a->kind)
4795
1.21M
      result = a->value.integer == b->value.integer;
4796
122k
        else if (XS_NUMBER_KIND == a->kind) {
4797
5.72k
      result = (!c_isnan(a->value.number)) && (!c_isnan(b->value.number)) && (a->value.number == b->value.number);
4798
5.72k
      mxFloatingPointOp("same slot");
4799
5.72k
    }
4800
116k
    else if ((XS_STRING_KIND == a->kind) || (XS_STRING_X_KIND == a->kind))
4801
569
      result = c_strcmp(a->value.string, b->value.string) == 0;
4802
116k
    else if (XS_SYMBOL_KIND == a->kind)
4803
0
      result = a->value.symbol == b->value.symbol;
4804
116k
    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
116k
    else if (XS_REFERENCE_KIND == a->kind)
4807
116k
      result = fxIsSameReference(the, a, b);
4808
1.34M
  }
4809
96.9k
  else if ((XS_INTEGER_KIND == a->kind) && (XS_NUMBER_KIND == b->kind)) {
4810
6.50k
    result = (!c_isnan(b->value.number)) && ((txNumber)(a->value.integer) == b->value.number);
4811
6.50k
    mxFloatingPointOp("same slot");
4812
6.50k
  }
4813
90.3k
  else if ((XS_NUMBER_KIND == a->kind) && (XS_INTEGER_KIND == b->kind)) {
4814
1.79k
    result = (!c_isnan(a->value.number)) && (a->value.number == (txNumber)(b->value.integer));
4815
1.79k
    mxFloatingPointOp("same slot");
4816
1.79k
  }
4817
88.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
88.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
88.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
88.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
1.44M
  return result;
4826
1.44M
}
4827
4828
txBoolean fxIsSameValue(txMachine* the, txSlot* a, txSlot* b, txBoolean zero)
4829
2.79M
{
4830
2.79M
  txBoolean result = 0;
4831
2.79M
  if (a->kind == b->kind) {
4832
336k
    if ((XS_UNDEFINED_KIND == a->kind) || (XS_NULL_KIND == a->kind))
4833
8.79k
      result = 1;
4834
327k
    else if (XS_BOOLEAN_KIND == a->kind)
4835
407
      result = a->value.boolean == b->value.boolean;
4836
327k
    else if (XS_INTEGER_KIND == a->kind)
4837
178k
      result = a->value.integer == b->value.integer;
4838
148k
        else if (XS_NUMBER_KIND == a->kind) {
4839
108k
      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
108k
      mxFloatingPointOp("same value");
4841
108k
    }
4842
40.1k
    else if ((XS_STRING_KIND == a->kind) || (XS_STRING_X_KIND == a->kind))
4843
31.9k
      result = c_strcmp(a->value.string, b->value.string) == 0;
4844
8.21k
    else if (XS_SYMBOL_KIND == a->kind)
4845
7.84k
      result = a->value.symbol == b->value.symbol;
4846
367
    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
367
    else if (XS_REFERENCE_KIND == a->kind)
4849
367
      result = fxIsSameReference(the, a, b);
4850
336k
  }
4851
2.45M
  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.33M
  else if ((XS_NUMBER_KIND == a->kind) && (XS_INTEGER_KIND == b->kind)) {
4857
662
    txNumber bNumber = b->value.integer;
4858
662
    result = (a->value.number == bNumber) && (zero || (signbit(a->value.number) == signbit(bNumber)));
4859
662
    mxFloatingPointOp("same value");
4860
662
  }
4861
2.33M
  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.33M
  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.33M
  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.33M
  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.79M
  return result;
4870
2.79M
}
4871
4872
txBoolean fxIsScopableSlot(txMachine* the, txSlot* instance, txID id)
4873
3.65M
{ 
4874
3.65M
  txBoolean result;
4875
3.65M
  fxBeginHost(the);
4876
3.65M
  mxPushReference(instance);
4877
3.65M
  result = mxHasID(id);
4878
3.65M
  if (result) {
4879
240k
    mxPushReference(instance);
4880
240k
    mxGetID(mxID(_Symbol_unscopables));
4881
240k
    if (mxIsReference(the->stack)) {
4882
1
      mxGetID(id);
4883
1
      result = fxToBoolean(the, the->stack) ? 0 : 1;
4884
1
    }
4885
240k
    mxPop();
4886
240k
  }
4887
3.65M
  fxEndHost(the);
4888
3.65M
  return result;
4889
3.65M
}
4890
4891
void fxRemapIDs(txMachine* the, txByte* codeBuffer, txSize codeSize, txID* theIDs)
4892
598k
{
4893
598k
  register const txS1* bytes = gxCodeSizes;
4894
598k
  register txByte* p = codeBuffer;
4895
598k
  register txByte* q = codeBuffer + codeSize;
4896
598k
  register txS1 offset;
4897
598k
  txID id;
4898
21.2M
  while (p < q) {
4899
    //fprintf(stderr, "%s", gxCodeNames[*((txU1*)p)]);
4900
20.6M
    offset = (txS1)c_read8(bytes + c_read8(p));
4901
20.6M
    if (0 < offset)
4902
16.2M
      p += offset;
4903
4.46M
    else if (0 == offset) {
4904
3.38M
      p++;
4905
3.38M
      mxDecodeID(p, id);
4906
3.38M
      if (id != XS_NO_ID) {
4907
3.33M
        id = theIDs[id];
4908
3.33M
        p -= sizeof(txID);
4909
3.33M
        mxEncodeID(p, id);
4910
3.33M
      }
4911
3.38M
    }
4912
1.08M
    else if (-1 == offset) {
4913
1.07M
      txU1 index;
4914
1.07M
      p++;
4915
1.07M
      index = *((txU1*)p);
4916
1.07M
      p += 1 + index;
4917
1.07M
    }
4918
14.2k
        else if (-2 == offset) {
4919
14.2k
      txU2 index;
4920
14.2k
            p++;
4921
14.2k
            mxDecode2(p, index);
4922
14.2k
            p += index;
4923
14.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
20.6M
  }
4932
598k
}
4933
4934
void fxRemapScript(txMachine* the, txScript* script)
4935
598k
{
4936
598k
  mxPushUndefined();
4937
598k
  if (script->symbolsBuffer) {
4938
598k
    txByte* p = script->symbolsBuffer;
4939
598k
    txID c, i;
4940
598k
    mxDecodeID(p, c);
4941
598k
    the->stack->value.callback.address = C_NULL;
4942
598k
    the->stack->value.IDs = (txID*)fxNewChunk(the, c * sizeof(txID));
4943
598k
    the->stack->kind = XS_IDS_KIND;
4944
598k
    the->stack->value.IDs[0] = XS_NO_ID;
4945
1.90M
    for (i = 1; i < c; i++) {
4946
1.30M
      txID id = fxNewNameC(the, (txString)p);
4947
1.30M
      the->stack->value.IDs[i] = id;
4948
1.30M
      p += mxStringLength((char*)p) + 1;
4949
1.30M
    }
4950
598k
    fxRemapIDs(the, script->codeBuffer, script->codeSize, the->stack->value.IDs);
4951
598k
    the->stack->value.IDs = C_NULL;
4952
598k
  }  
4953
0
  else {
4954
0
    the->stack->value.IDs = C_NULL;
4955
0
    the->stack->kind = XS_IDS_KIND;
4956
0
  }
4957
598k
}
4958
4959
txBoolean fxToNumericInteger(txMachine* the, txSlot* theSlot)
4960
11.2M
{
4961
11.2M
  if (theSlot->kind == XS_REFERENCE_KIND)
4962
276k
    fxToPrimitive(the, theSlot, XS_NUMBER_HINT);
4963
11.2M
  if ((theSlot->kind == XS_BIGINT_KIND) || (theSlot->kind == XS_BIGINT_X_KIND))
4964
927k
    return 0;
4965
10.3M
  fxToInteger(the, theSlot);
4966
10.3M
  return 1;
4967
11.2M
}
4968
4969
txBoolean fxToNumericIntegerUnary(txMachine* the, txSlot* a, txBigIntUnary op)
4970
1.02M
{
4971
1.02M
  if (fxToNumericInteger(the, a))
4972
742k
    return 1;
4973
280k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint);
4974
280k
  a->kind = XS_BIGINT_KIND;
4975
280k
  the->stack = a;
4976
280k
  return 0;   
4977
1.02M
}
4978
4979
txBoolean fxToNumericIntegerBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op)
4980
5.11M
{
4981
5.11M
  txBoolean ra = fxToNumericInteger(the, a);
4982
5.11M
  txBoolean rb = fxToNumericInteger(the, b);
4983
5.11M
  if (ra) {
4984
4.78M
    if (rb)
4985
4.78M
      return 1;
4986
4.78M
    mxTypeError("cannot coerce left operand to bigint");
4987
4.78M
  }
4988
324k
  else if (rb)
4989
1.60k
    mxTypeError("cannot coerce right operand to bigint");
4990
322k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint, &b->value.bigint);
4991
322k
  a->kind = XS_BIGINT_KIND;
4992
322k
  the->stack = b;
4993
322k
  return 0;   
4994
5.11M
}
4995
4996
txBoolean fxToNumericNumber(txMachine* the, txSlot* theSlot)
4997
36.6M
{
4998
36.6M
  if (theSlot->kind == XS_REFERENCE_KIND)
4999
4.13M
    fxToPrimitive(the, theSlot, XS_NUMBER_HINT);
5000
36.6M
  if ((theSlot->kind == XS_BIGINT_KIND) || (theSlot->kind == XS_BIGINT_X_KIND))
5001
7.15M
    return 0;
5002
29.4M
  fxToNumber(the, theSlot);
5003
29.4M
  return 1;
5004
36.6M
}
5005
5006
txBoolean fxToNumericNumberUnary(txMachine* the, txSlot* a, txBigIntUnary op)
5007
10.5M
{
5008
10.5M
  if (fxToNumericNumber(the, a))
5009
5.09M
    return 1;
5010
5.50M
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint);
5011
5.50M
  a->kind = XS_BIGINT_KIND;
5012
5.50M
  the->stack = a;
5013
5.50M
  return 0;   
5014
10.5M
}
5015
5016
txBoolean fxToNumericNumberBinary(txMachine* the, txSlot* a, txSlot* b, txBigIntBinary op)
5017
11.7M
{
5018
11.7M
  txBoolean ra = fxToNumericNumber(the, a);
5019
11.7M
  txBoolean rb = fxToNumericNumber(the, b);
5020
11.7M
  if (ra) {
5021
10.9M
    if (rb)
5022
10.9M
      return 1;
5023
10.9M
    mxTypeError("cannot coerce left operand to bigint");
5024
10.9M
  }
5025
829k
  else if (rb)
5026
1.14k
    mxTypeError("cannot coerce right operand to bigint");
5027
828k
  a->value.bigint = *(*op)(the, C_NULL, &a->value.bigint, &b->value.bigint);
5028
828k
  a->kind = XS_BIGINT_KIND;
5029
828k
  the->stack = b;
5030
828k
  return 0;   
5031
11.7M
}
5032
5033
void fxRunScript(txMachine* the, txScript* script, txSlot* _this, txSlot* _target, txSlot* closures, txSlot* object, txSlot* module)
5034
598k
{
5035
598k
  if (script) {
5036
598k
    mxTry(the) {
5037
598k
      txSlot* instance;
5038
598k
      txSlot* property;
5039
598k
      __JUMP__.code = C_NULL;
5040
598k
      fxRemapScript(the, script);
5041
598k
      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
598k
      else {
5065
598k
        mxPushUndefined();
5066
598k
      }
5067
598k
      mxPull(mxHosts);
5068
598k
      mxPop();
5069
5070
      /* TARGET */
5071
598k
      if (_target)
5072
0
        mxPushSlot(_target);
5073
      /* THIS */
5074
598k
      if (_this)
5075
467k
        mxPushSlot(_this);
5076
130k
      else
5077
130k
        mxPushUndefined();
5078
598k
      the->stack->ID = XS_NO_ID;
5079
      /* FUNCTION */
5080
598k
      mxPush(mxFunctionPrototype);
5081
598k
      instance = fxNewFunctionInstance(the, XS_NO_ID);
5082
598k
      instance->next->kind = XS_CODE_X_KIND;
5083
598k
      instance->next->value.code.address = script->codeBuffer;
5084
598k
      instance->next->value.code.closures = closures;
5085
598k
      property = mxFunctionInstanceHome(instance);
5086
598k
      property->ID = fxGenerateProfileID(the);
5087
598k
      property->value.home.object = object;
5088
598k
      property->value.home.module = module;
5089
      /* RESULT */
5090
598k
            mxPushUndefined();
5091
      /* FRAME */
5092
598k
      mxPushUninitialized();
5093
598k
      if (_target)
5094
0
        the->stack->flag |= XS_TARGET_FLAG;
5095
598k
      mxRunCount(0);
5096
5097
598k
      mxPushUndefined();
5098
598k
      mxPull(mxHosts);
5099
598k
      if (script->symbolsBuffer)
5100
101k
        fxDeleteScript(script);
5101
598k
    }
5102
598k
    mxCatch(the) {
5103
496k
      if (script->symbolsBuffer)
5104
496k
        fxDeleteScript(script);
5105
496k
      fxJump(the);
5106
496k
    }
5107
598k
  }
5108
0
  else {
5109
0
    mxSyntaxError("invalid script");
5110
0
  }
5111
598k
}
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
598k
{
5194
598k
  txMachine* the = console;
5195
598k
  the->meterIndex += count * XS_PARSE_CODE_METERING;
5196
598k
}
5197
#endif
5198
5199
5200
5201
5202
5203
5204
5205