/
context.h
595 lines (504 loc) · 22.5 KB
/
context.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
/* context.h
* Copyright (C) 2009-2011, Parrot Foundation.
* Overview:
* Context
*/
#ifndef PARROT_CONTEXT_H_GUARD
#define PARROT_CONTEXT_H_GUARD
#include "parrot/string.h"
#include "parrot/compiler.h"
struct PackFile_ConstTable;
typedef union {
PMC **regs_p;
STRING **regs_s;
} Regs_ps;
typedef union {
FLOATVAL *regs_n;
INTVAL *regs_i;
} Regs_ni;
#include "pmc/pmc_callcontext.h"
typedef struct Parrot_CallContext_attributes Parrot_Context;
#define CONTEXT_STRUCT(c) (PMC_data_typed((c), Parrot_Context *))
/* ((Parrot_Context *)ctx->data)->n_regs_used */
#define PCC_GET_REGS_USED(ctx, type) CONTEXT_STRUCT(ctx)->n_regs_used[type]
/*
* Macros to make accessing registers more convenient/readable.
*/
#ifndef NDEBUG
# define CTX_REG_PMC(i, p, x) (*Parrot_pcc_get_PMC_reg((i), (p), (x)))
# define CTX_REG_STR(i, p, x) (*Parrot_pcc_get_STRING_reg((i), (p), (x)))
# define CTX_REG_NUM(i, p, x) (*Parrot_pcc_get_FLOATVAL_reg((i), (p), (x)))
# define CTX_REG_INT(i, p, x) (*Parrot_pcc_get_INTVAL_reg((i), (p), (x)))
#else /* NDEBUG */
/* Manually inlined macros. Used in optimized builds */
# define CTX_REG_PMC(i, p, x) (CONTEXT_STRUCT(p)->bp_ps.regs_p[-1L - (x)])
# define CTX_REG_STR(i, p, x) (CONTEXT_STRUCT(p)->bp_ps.regs_s[(x)])
# define CTX_REG_NUM(i, p, x) (CONTEXT_STRUCT(p)->bp.regs_n[-1L - (x)])
# define CTX_REG_INT(i, p, x) (CONTEXT_STRUCT(p)->bp.regs_i[(x)])
#endif
#define REG_NUM(interp, x) CTX_REG_NUM((interp), (interp)->ctx, (x))
#define REG_INT(interp, x) CTX_REG_INT((interp), (interp)->ctx, (x))
#define REG_PMC(interp, x) CTX_REG_PMC((interp), (interp)->ctx, (x))
#define REG_STR(interp, x) CTX_REG_STR((interp), (interp)->ctx, (x))
#define REGNO_INT 0
#define REGNO_NUM 1
#define REGNO_STR 2
#define REGNO_PMC 3
/* Context accessors functions */
/*
* For optimized builds we provide macros which directly poke into
* Parrot_Context.
*/
/* HEADERIZER BEGIN: src/call/context_accessors.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
UINTVAL Parrot_pcc_dec_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_errors_off_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_errors_on_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
UINTVAL Parrot_pcc_errors_test_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_caller_ctx_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_PURE_FUNCTION
Parrot_Context* Parrot_pcc_get_context_struct_func(PARROT_INTERP,
ARGIN_NULLOK(PMC *ctx));
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_continuation_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_handlers_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
INTVAL Parrot_pcc_get_HLL_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CANNOT_RETURN_NULL
PMC* Parrot_pcc_get_lex_pad_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_namespace_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
FLOATVAL Parrot_pcc_get_num_constant_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
INTVAL idx)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_PURE_FUNCTION
FLOATVAL * Parrot_pcc_get_num_constants_func(PARROT_INTERP,
ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_outer_ctx_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
opcode_t* Parrot_pcc_get_pc_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_pmc_constant_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
INTVAL idx)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_PURE_FUNCTION
PMC ** Parrot_pcc_get_pmc_constants_func(PARROT_INTERP,
ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
UINTVAL Parrot_pcc_get_recursion_depth_func(PARROT_INTERP,
ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_signature_func(PARROT_INTERP, ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_PURE_FUNCTION
STRING ** Parrot_pcc_get_str_constants_func(PARROT_INTERP,
ARGIN(const PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
STRING* Parrot_pcc_get_string_constant_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
INTVAL idx)
__attribute__nonnull__(2);
PARROT_EXPORT
UINTVAL Parrot_pcc_inc_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_set_caller_ctx_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN(PMC *caller_ctx))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
void Parrot_pcc_set_constants_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN(const struct PackFile_ConstTable *ct))
__attribute__nonnull__(2)
__attribute__nonnull__(3);
PARROT_EXPORT
void Parrot_pcc_set_continuation_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN_NULLOK(PMC *_continuation))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_set_handlers_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN(PMC *handlers))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
PARROT_EXPORT
void Parrot_pcc_set_HLL_func(PARROT_INTERP, ARGIN(PMC *ctx), INTVAL hll)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_set_lex_pad_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN(PMC *lex_pad))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
PARROT_EXPORT
void Parrot_pcc_set_namespace_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN_NULLOK(PMC *_namespace))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_set_outer_ctx_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN(PMC *outer_ctx))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
PARROT_EXPORT
void Parrot_pcc_set_pc_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
ARGIN_NULLOK(opcode_t *pc))
__attribute__nonnull__(2);
PARROT_EXPORT
UINTVAL Parrot_pcc_set_recursion_depth_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
const int new_depth)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_set_signature_func(PARROT_INTERP,
ARGIN(PMC *ctx),
ARGIN_NULLOK(PMC *sig_object))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_trace_flags_off_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_trace_flags_on_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
UINTVAL Parrot_pcc_trace_flags_test_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pcc_warnings_off_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
UINTVAL Parrot_pcc_warnings_on_func(PARROT_INTERP,
ARGIN(PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_PURE_FUNCTION
UINTVAL Parrot_pcc_warnings_test_func(PARROT_INTERP,
ARGIN(const PMC *ctx),
UINTVAL flags)
__attribute__nonnull__(2);
#define ASSERT_ARGS_Parrot_pcc_dec_recursion_depth_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_errors_off_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_errors_on_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_errors_test_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_caller_ctx_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_context_struct_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_pcc_get_continuation_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_handlers_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_HLL_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_lex_pad_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_namespace_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_num_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_num_constants_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_outer_ctx_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_pc_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_pmc_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_pmc_constants_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_recursion_depth_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_str_constants_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_string_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_inc_recursion_depth_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_caller_ctx_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(caller_ctx))
#define ASSERT_ARGS_Parrot_pcc_set_constants_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(ct))
#define ASSERT_ARGS_Parrot_pcc_set_continuation_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_handlers_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(handlers))
#define ASSERT_ARGS_Parrot_pcc_set_HLL_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_lex_pad_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(lex_pad))
#define ASSERT_ARGS_Parrot_pcc_set_namespace_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_outer_ctx_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(outer_ctx))
#define ASSERT_ARGS_Parrot_pcc_set_pc_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_recursion_depth_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_trace_flags_off_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_trace_flags_on_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_trace_flags_test_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_warnings_off_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_warnings_on_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_warnings_test_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/call/context_accessors.c */
/* Map Context manipulating functions to functions or macros */
#ifdef NDEBUG
# define Parrot_pcc_get_context_struct(i, c) CONTEXT_STRUCT(c)
# define Parrot_pcc_get_num_constants(i, c) (CONTEXT_STRUCT(c)->num_constants)
# define Parrot_pcc_get_str_constants(i, c) (CONTEXT_STRUCT(c)->str_constants)
# define Parrot_pcc_get_pmc_constants(i, c) (CONTEXT_STRUCT(c)->pmc_constants)
# define Parrot_pcc_set_constants(i, c, ct) do { \
CONTEXT_STRUCT(c)->num_constants = (ct)->num.constants; \
CONTEXT_STRUCT(c)->str_constants = (ct)->str.constants; \
CONTEXT_STRUCT(c)->pmc_constants = (ct)->pmc.constants; \
} while (0)
# define Parrot_pcc_get_continuation(i, c) (CONTEXT_STRUCT(c)->current_cont)
# define Parrot_pcc_get_caller_ctx(i, c) (CONTEXT_STRUCT(c)->caller_ctx)
# define Parrot_pcc_get_namespace(i, c) (CONTEXT_STRUCT(c)->current_namespace)
# define Parrot_pcc_get_lex_pad(i, c) (CONTEXT_STRUCT(c)->lex_pad)
# define Parrot_pcc_get_handlers(i, c) (CONTEXT_STRUCT(c)->handlers)
# define Parrot_pcc_get_pc(i, c) (CONTEXT_STRUCT(c)->current_pc)
# define Parrot_pcc_set_pc(i, c, value) (CONTEXT_STRUCT(c)->current_pc = (value))
# define Parrot_pcc_get_HLL(i, c) (CONTEXT_STRUCT(c)->current_HLL)
# define Parrot_pcc_set_HLL(i, c, value) (CONTEXT_STRUCT(c)->current_HLL = (value))
# define Parrot_pcc_get_outer_ctx(i, c) (CONTEXT_STRUCT(c)->outer_ctx)
# define Parrot_pcc_get_signature(i, c) (CONTEXT_STRUCT(c)->current_sig)
# define Parrot_pcc_get_num_constant(i, c, idx) (CONTEXT_STRUCT(c)->num_constants[(idx)])
# define Parrot_pcc_get_string_constant(i, c, idx) (CONTEXT_STRUCT(c)->str_constants[(idx)])
# define Parrot_pcc_get_pmc_constant(i, c, idx) (CONTEXT_STRUCT(c)->pmc_constants[(idx)])
# define Parrot_pcc_get_recursion_depth(i, c) (CONTEXT_STRUCT(c)->recursion_depth)
# define Parrot_pcc_set_recursion_depth(i, c, d) (CONTEXT_STRUCT(c)->recursion_depth = (d))
# define Parrot_pcc_dec_recursion_depth(i, c) (--CONTEXT_STRUCT(c)->recursion_depth)
# define Parrot_pcc_inc_recursion_depth(i, c) (++CONTEXT_STRUCT(c)->recursion_depth)
# define Parrot_pcc_warnings_on(i, c, flags) (CONTEXT_STRUCT(c)->warns |= (flags))
# define Parrot_pcc_warnings_off(i, c, flags) (CONTEXT_STRUCT(c)->warns &= ~(flags))
# define Parrot_pcc_warnings_test(i, c, flags) (CONTEXT_STRUCT(c)->warns & (flags))
# define Parrot_pcc_errors_on(i, c, flags) (CONTEXT_STRUCT(c)->errors |= (flags))
# define Parrot_pcc_errors_off(i, c, flags) (CONTEXT_STRUCT(c)->errors &= ~(flags))
# define Parrot_pcc_errors_test(i, c, flags) (CONTEXT_STRUCT(c)->errors & (flags))
# define Parrot_pcc_trace_flags_on(i, c, flags) (CONTEXT_STRUCT(c)->trace_flags |= (flags))
# define Parrot_pcc_trace_flags_off(i, c, flags) (CONTEXT_STRUCT(c)->trace_flags &= ~(flags))
# define Parrot_pcc_trace_flags_test(i, c, flags) (CONTEXT_STRUCT(c)->trace_flags & (flags))
#else
# define Parrot_pcc_get_context_struct(i, c) Parrot_pcc_get_context_struct_func((i), (c))
# define Parrot_pcc_get_num_constants(i, c) Parrot_pcc_get_num_constants_func((i), (c))
# define Parrot_pcc_get_str_constants(i, c) Parrot_pcc_get_str_constants_func((i), (c))
# define Parrot_pcc_get_pmc_constants(i, c) Parrot_pcc_get_pmc_constants_func((i), (c))
# define Parrot_pcc_set_constants(i, c, value) Parrot_pcc_set_constants_func((i), (c), (value))
# define Parrot_pcc_get_continuation(i, c) Parrot_pcc_get_continuation_func((i), (c))
# define Parrot_pcc_get_caller_ctx(i, c) Parrot_pcc_get_caller_ctx_func((i), (c))
# define Parrot_pcc_get_namespace(i, c) Parrot_pcc_get_namespace_func((i), (c))
# define Parrot_pcc_get_pc(i, c) Parrot_pcc_get_pc_func((i), (c))
# define Parrot_pcc_set_pc(i, c, value) Parrot_pcc_set_pc_func((i), (c), (value))
# define Parrot_pcc_get_HLL(i, c) Parrot_pcc_get_HLL_func((i), (c))
# define Parrot_pcc_set_HLL(i, c, value) Parrot_pcc_set_HLL_func((i), (c), (value))
# define Parrot_pcc_get_object(i, c) Parrot_pcc_get_object_func((i), (c))
# define Parrot_pcc_get_lex_pad(i, c) Parrot_pcc_get_lex_pad_func((i), (c))
# define Parrot_pcc_get_handlers(i, c) Parrot_pcc_get_handlers_func((i), (c))
# define Parrot_pcc_get_outer_ctx(i, c) Parrot_pcc_get_outer_ctx_func((i), (c))
# define Parrot_pcc_get_signature(i, c) Parrot_pcc_get_signature_func((i), (c))
# define Parrot_pcc_get_num_constant(i, c, idx) Parrot_pcc_get_num_constant_func((i), (c), (idx))
# define Parrot_pcc_get_string_constant(i, c, idx) \
Parrot_pcc_get_string_constant_func((i), (c), (idx))
# define Parrot_pcc_get_pmc_constant(i, c, idx) Parrot_pcc_get_pmc_constant_func((i), (c), (idx))
# define Parrot_pcc_get_recursion_depth(i, c) Parrot_pcc_get_recursion_depth_func((i), (c))
# define Parrot_pcc_set_recursion_depth(i, c, d) \
Parrot_pcc_set_recursion_depth_func((i), (c), (d))
# define Parrot_pcc_dec_recursion_depth(i, c) Parrot_pcc_dec_recursion_depth_func((i), (c))
# define Parrot_pcc_inc_recursion_depth(i, c) Parrot_pcc_inc_recursion_depth_func((i), (c))
# define Parrot_pcc_warnings_on(i, c, flags) Parrot_pcc_warnings_on_func((i), (c), (flags))
# define Parrot_pcc_warnings_off(i, c, flags) Parrot_pcc_warnings_off_func((i), (c), (flags))
# define Parrot_pcc_warnings_test(i, c, flags) Parrot_pcc_warnings_test_func((i), (c), (flags))
# define Parrot_pcc_errors_on(i, c, flags) Parrot_pcc_errors_on_func((i), (c), (flags))
# define Parrot_pcc_errors_off(i, c, flags) Parrot_pcc_errors_off_func((i), (c), (flags))
# define Parrot_pcc_errors_test(i, c, flags) Parrot_pcc_errors_test_func((i), (c), (flags))
# define Parrot_pcc_trace_flags_on(i, c, flags) Parrot_pcc_trace_flags_on_func((i), (c), (flags))
# define Parrot_pcc_trace_flags_off(i, c, flags) \
Parrot_pcc_trace_flags_off_func((i), (c), (flags))
# define Parrot_pcc_trace_flags_test(i, c, flags) \
Parrot_pcc_trace_flags_test_func((i), (c), (flags))
#endif /* ifndef NDEBUG */
#ifdef NDEBUG
# define Parrot_pcc_set_continuation(i, c, value) do { \
CONTEXT_STRUCT(c)->current_cont = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_caller_ctx(i, c, value) do { \
CONTEXT_STRUCT(c)->caller_ctx = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_namespace(i, c, value) do { \
PARROT_ASSERT_INTERP((value), (i)); \
CONTEXT_STRUCT(c)->current_namespace = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_lex_pad(i, c, value) do { \
CONTEXT_STRUCT(c)->lex_pad = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_handlers(i, c, value) do { \
CONTEXT_STRUCT(c)->handlers = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_outer_ctx(i, c, value) do { \
CONTEXT_STRUCT(c)->outer_ctx = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_signature(i, c, value) do { \
CONTEXT_STRUCT(c)->current_sig = (value); \
PARROT_GC_WRITE_BARRIER((i), (c)); \
} while (0)
# define Parrot_pcc_set_context(i, c) do { \
CURRENT_CONTEXT(i) = (c); \
} while (0)
#else
# define Parrot_pcc_set_continuation(i, c, value) \
Parrot_pcc_set_continuation_func((i), (c), (value))
# define Parrot_pcc_set_caller_ctx(i, c, value) Parrot_pcc_set_caller_ctx_func((i), (c), (value))
# define Parrot_pcc_set_namespace(i, c, value) Parrot_pcc_set_namespace_func((i), (c), (value))
# define Parrot_pcc_set_object(i, c, value) Parrot_pcc_set_object_func((i), (c), (value))
# define Parrot_pcc_set_lex_pad(i, c, value) Parrot_pcc_set_lex_pad_func((i), (c), (value))
# define Parrot_pcc_set_handlers(i, c, value) Parrot_pcc_set_handlers_func((i), (c), (value))
# define Parrot_pcc_set_outer_ctx(i, c, value) Parrot_pcc_set_outer_ctx_func((i), (c), (value))
# define Parrot_pcc_set_signature(i, c, value) Parrot_pcc_set_signature_func((i), (c), (value))
# define Parrot_pcc_set_context(i, c) Parrot_pcc_set_context_func((i), (c))
#endif /* ifdef NDEBUG */
#endif /* PARROT_CONTEXT_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/