-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlua_CompileOptions.java
More file actions
679 lines (587 loc) · 19.2 KB
/
lua_CompileOptions.java
File metadata and controls
679 lines (587 loc) · 19.2 KB
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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
// Generated by jextract
package net.hollowcube.luau.internal.compiler;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet lang=c :
* struct lua_CompileOptions {
* int optimizationLevel;
* int debugLevel;
* int typeInfoLevel;
* int coverageLevel;
* const char *vectorLib;
* const char *vectorCtor;
* const char *vectorType;
* const char *const *mutableGlobals;
* const char *const *userdataTypes;
* const char *const *librariesWithKnownMembers;
* lua_LibraryMemberTypeCallback libraryMemberTypeCb;
* lua_LibraryMemberConstantCallback libraryMemberConstantCb;
* const char *const *disabledBuiltins;
* }
* }
*/
public class lua_CompileOptions {
lua_CompileOptions() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
luacode_h.C_INT.withName("optimizationLevel"),
luacode_h.C_INT.withName("debugLevel"),
luacode_h.C_INT.withName("typeInfoLevel"),
luacode_h.C_INT.withName("coverageLevel"),
luacode_h.C_POINTER.withName("vectorLib"),
luacode_h.C_POINTER.withName("vectorCtor"),
luacode_h.C_POINTER.withName("vectorType"),
luacode_h.C_POINTER.withName("mutableGlobals"),
luacode_h.C_POINTER.withName("userdataTypes"),
luacode_h.C_POINTER.withName("librariesWithKnownMembers"),
luacode_h.C_POINTER.withName("libraryMemberTypeCb"),
luacode_h.C_POINTER.withName("libraryMemberConstantCb"),
luacode_h.C_POINTER.withName("disabledBuiltins")
).withName("lua_CompileOptions");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt optimizationLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("optimizationLevel"));
/**
* Layout for field:
* {@snippet lang=c :
* int optimizationLevel
* }
*/
public static final OfInt optimizationLevel$layout() {
return optimizationLevel$LAYOUT;
}
private static final long optimizationLevel$OFFSET = $LAYOUT.byteOffset(groupElement("optimizationLevel"));
/**
* Offset for field:
* {@snippet lang=c :
* int optimizationLevel
* }
*/
public static final long optimizationLevel$offset() {
return optimizationLevel$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int optimizationLevel
* }
*/
public static int optimizationLevel(MemorySegment struct) {
return struct.get(optimizationLevel$LAYOUT, optimizationLevel$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int optimizationLevel
* }
*/
public static void optimizationLevel(MemorySegment struct, int fieldValue) {
struct.set(optimizationLevel$LAYOUT, optimizationLevel$OFFSET, fieldValue);
}
private static final OfInt debugLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("debugLevel"));
/**
* Layout for field:
* {@snippet lang=c :
* int debugLevel
* }
*/
public static final OfInt debugLevel$layout() {
return debugLevel$LAYOUT;
}
private static final long debugLevel$OFFSET = $LAYOUT.byteOffset(groupElement("debugLevel"));
/**
* Offset for field:
* {@snippet lang=c :
* int debugLevel
* }
*/
public static final long debugLevel$offset() {
return debugLevel$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int debugLevel
* }
*/
public static int debugLevel(MemorySegment struct) {
return struct.get(debugLevel$LAYOUT, debugLevel$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int debugLevel
* }
*/
public static void debugLevel(MemorySegment struct, int fieldValue) {
struct.set(debugLevel$LAYOUT, debugLevel$OFFSET, fieldValue);
}
private static final OfInt typeInfoLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("typeInfoLevel"));
/**
* Layout for field:
* {@snippet lang=c :
* int typeInfoLevel
* }
*/
public static final OfInt typeInfoLevel$layout() {
return typeInfoLevel$LAYOUT;
}
private static final long typeInfoLevel$OFFSET = $LAYOUT.byteOffset(groupElement("typeInfoLevel"));
/**
* Offset for field:
* {@snippet lang=c :
* int typeInfoLevel
* }
*/
public static final long typeInfoLevel$offset() {
return typeInfoLevel$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int typeInfoLevel
* }
*/
public static int typeInfoLevel(MemorySegment struct) {
return struct.get(typeInfoLevel$LAYOUT, typeInfoLevel$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int typeInfoLevel
* }
*/
public static void typeInfoLevel(MemorySegment struct, int fieldValue) {
struct.set(typeInfoLevel$LAYOUT, typeInfoLevel$OFFSET, fieldValue);
}
private static final OfInt coverageLevel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("coverageLevel"));
/**
* Layout for field:
* {@snippet lang=c :
* int coverageLevel
* }
*/
public static final OfInt coverageLevel$layout() {
return coverageLevel$LAYOUT;
}
private static final long coverageLevel$OFFSET = $LAYOUT.byteOffset(groupElement("coverageLevel"));
/**
* Offset for field:
* {@snippet lang=c :
* int coverageLevel
* }
*/
public static final long coverageLevel$offset() {
return coverageLevel$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int coverageLevel
* }
*/
public static int coverageLevel(MemorySegment struct) {
return struct.get(coverageLevel$LAYOUT, coverageLevel$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int coverageLevel
* }
*/
public static void coverageLevel(MemorySegment struct, int fieldValue) {
struct.set(coverageLevel$LAYOUT, coverageLevel$OFFSET, fieldValue);
}
private static final AddressLayout vectorLib$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("vectorLib"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *vectorLib
* }
*/
public static final AddressLayout vectorLib$layout() {
return vectorLib$LAYOUT;
}
private static final long vectorLib$OFFSET = $LAYOUT.byteOffset(groupElement("vectorLib"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *vectorLib
* }
*/
public static final long vectorLib$offset() {
return vectorLib$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *vectorLib
* }
*/
public static MemorySegment vectorLib(MemorySegment struct) {
return struct.get(vectorLib$LAYOUT, vectorLib$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *vectorLib
* }
*/
public static void vectorLib(MemorySegment struct, MemorySegment fieldValue) {
struct.set(vectorLib$LAYOUT, vectorLib$OFFSET, fieldValue);
}
private static final AddressLayout vectorCtor$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("vectorCtor"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *vectorCtor
* }
*/
public static final AddressLayout vectorCtor$layout() {
return vectorCtor$LAYOUT;
}
private static final long vectorCtor$OFFSET = $LAYOUT.byteOffset(groupElement("vectorCtor"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *vectorCtor
* }
*/
public static final long vectorCtor$offset() {
return vectorCtor$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *vectorCtor
* }
*/
public static MemorySegment vectorCtor(MemorySegment struct) {
return struct.get(vectorCtor$LAYOUT, vectorCtor$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *vectorCtor
* }
*/
public static void vectorCtor(MemorySegment struct, MemorySegment fieldValue) {
struct.set(vectorCtor$LAYOUT, vectorCtor$OFFSET, fieldValue);
}
private static final AddressLayout vectorType$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("vectorType"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *vectorType
* }
*/
public static final AddressLayout vectorType$layout() {
return vectorType$LAYOUT;
}
private static final long vectorType$OFFSET = $LAYOUT.byteOffset(groupElement("vectorType"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *vectorType
* }
*/
public static final long vectorType$offset() {
return vectorType$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *vectorType
* }
*/
public static MemorySegment vectorType(MemorySegment struct) {
return struct.get(vectorType$LAYOUT, vectorType$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *vectorType
* }
*/
public static void vectorType(MemorySegment struct, MemorySegment fieldValue) {
struct.set(vectorType$LAYOUT, vectorType$OFFSET, fieldValue);
}
private static final AddressLayout mutableGlobals$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("mutableGlobals"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *const *mutableGlobals
* }
*/
public static final AddressLayout mutableGlobals$layout() {
return mutableGlobals$LAYOUT;
}
private static final long mutableGlobals$OFFSET = $LAYOUT.byteOffset(groupElement("mutableGlobals"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *const *mutableGlobals
* }
*/
public static final long mutableGlobals$offset() {
return mutableGlobals$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *const *mutableGlobals
* }
*/
public static MemorySegment mutableGlobals(MemorySegment struct) {
return struct.get(mutableGlobals$LAYOUT, mutableGlobals$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *const *mutableGlobals
* }
*/
public static void mutableGlobals(MemorySegment struct, MemorySegment fieldValue) {
struct.set(mutableGlobals$LAYOUT, mutableGlobals$OFFSET, fieldValue);
}
private static final AddressLayout userdataTypes$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("userdataTypes"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *const *userdataTypes
* }
*/
public static final AddressLayout userdataTypes$layout() {
return userdataTypes$LAYOUT;
}
private static final long userdataTypes$OFFSET = $LAYOUT.byteOffset(groupElement("userdataTypes"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *const *userdataTypes
* }
*/
public static final long userdataTypes$offset() {
return userdataTypes$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *const *userdataTypes
* }
*/
public static MemorySegment userdataTypes(MemorySegment struct) {
return struct.get(userdataTypes$LAYOUT, userdataTypes$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *const *userdataTypes
* }
*/
public static void userdataTypes(MemorySegment struct, MemorySegment fieldValue) {
struct.set(userdataTypes$LAYOUT, userdataTypes$OFFSET, fieldValue);
}
private static final AddressLayout librariesWithKnownMembers$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("librariesWithKnownMembers"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *const *librariesWithKnownMembers
* }
*/
public static final AddressLayout librariesWithKnownMembers$layout() {
return librariesWithKnownMembers$LAYOUT;
}
private static final long librariesWithKnownMembers$OFFSET = $LAYOUT.byteOffset(groupElement("librariesWithKnownMembers"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *const *librariesWithKnownMembers
* }
*/
public static final long librariesWithKnownMembers$offset() {
return librariesWithKnownMembers$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *const *librariesWithKnownMembers
* }
*/
public static MemorySegment librariesWithKnownMembers(MemorySegment struct) {
return struct.get(librariesWithKnownMembers$LAYOUT, librariesWithKnownMembers$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *const *librariesWithKnownMembers
* }
*/
public static void librariesWithKnownMembers(MemorySegment struct, MemorySegment fieldValue) {
struct.set(librariesWithKnownMembers$LAYOUT, librariesWithKnownMembers$OFFSET, fieldValue);
}
private static final AddressLayout libraryMemberTypeCb$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("libraryMemberTypeCb"));
/**
* Layout for field:
* {@snippet lang=c :
* lua_LibraryMemberTypeCallback libraryMemberTypeCb
* }
*/
public static final AddressLayout libraryMemberTypeCb$layout() {
return libraryMemberTypeCb$LAYOUT;
}
private static final long libraryMemberTypeCb$OFFSET = $LAYOUT.byteOffset(groupElement("libraryMemberTypeCb"));
/**
* Offset for field:
* {@snippet lang=c :
* lua_LibraryMemberTypeCallback libraryMemberTypeCb
* }
*/
public static final long libraryMemberTypeCb$offset() {
return libraryMemberTypeCb$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* lua_LibraryMemberTypeCallback libraryMemberTypeCb
* }
*/
public static MemorySegment libraryMemberTypeCb(MemorySegment struct) {
return struct.get(libraryMemberTypeCb$LAYOUT, libraryMemberTypeCb$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* lua_LibraryMemberTypeCallback libraryMemberTypeCb
* }
*/
public static void libraryMemberTypeCb(MemorySegment struct, MemorySegment fieldValue) {
struct.set(libraryMemberTypeCb$LAYOUT, libraryMemberTypeCb$OFFSET, fieldValue);
}
private static final AddressLayout libraryMemberConstantCb$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("libraryMemberConstantCb"));
/**
* Layout for field:
* {@snippet lang=c :
* lua_LibraryMemberConstantCallback libraryMemberConstantCb
* }
*/
public static final AddressLayout libraryMemberConstantCb$layout() {
return libraryMemberConstantCb$LAYOUT;
}
private static final long libraryMemberConstantCb$OFFSET = $LAYOUT.byteOffset(groupElement("libraryMemberConstantCb"));
/**
* Offset for field:
* {@snippet lang=c :
* lua_LibraryMemberConstantCallback libraryMemberConstantCb
* }
*/
public static final long libraryMemberConstantCb$offset() {
return libraryMemberConstantCb$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* lua_LibraryMemberConstantCallback libraryMemberConstantCb
* }
*/
public static MemorySegment libraryMemberConstantCb(MemorySegment struct) {
return struct.get(libraryMemberConstantCb$LAYOUT, libraryMemberConstantCb$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* lua_LibraryMemberConstantCallback libraryMemberConstantCb
* }
*/
public static void libraryMemberConstantCb(MemorySegment struct, MemorySegment fieldValue) {
struct.set(libraryMemberConstantCb$LAYOUT, libraryMemberConstantCb$OFFSET, fieldValue);
}
private static final AddressLayout disabledBuiltins$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("disabledBuiltins"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *const *disabledBuiltins
* }
*/
public static final AddressLayout disabledBuiltins$layout() {
return disabledBuiltins$LAYOUT;
}
private static final long disabledBuiltins$OFFSET = $LAYOUT.byteOffset(groupElement("disabledBuiltins"));
/**
* Offset for field:
* {@snippet lang=c :
* const char *const *disabledBuiltins
* }
*/
public static final long disabledBuiltins$offset() {
return disabledBuiltins$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *const *disabledBuiltins
* }
*/
public static MemorySegment disabledBuiltins(MemorySegment struct) {
return struct.get(disabledBuiltins$LAYOUT, disabledBuiltins$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *const *disabledBuiltins
* }
*/
public static void disabledBuiltins(MemorySegment struct, MemorySegment fieldValue) {
struct.set(disabledBuiltins$LAYOUT, disabledBuiltins$OFFSET, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
}