This repository has been archived by the owner on Nov 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuilder.c
1003 lines (789 loc) · 36.4 KB
/
builder.c
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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
+--------------------------------------------------------------------------+
| Zephir Language |
+--------------------------------------------------------------------------+
| Copyright (c) 2013-2014 Zephir Team and contributors |
+--------------------------------------------------------------------------+
| This source file is subject the MIT license, that is bundled with |
| this package in the file LICENSE, and is available through the |
| world-wide-web at the following url: |
| http://zephir-lang.com/license.html |
| |
| If you did not receive a copy of the MIT license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+--------------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#include "php_zephir.h"
#include "zephir.h"
#include "utils.h"
#include "symtable.h"
#include "builder.h"
#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/operators.h"
int zephir_initialize_zval_struct(zephir_context *context)
{
LLVMTypeRef zval_struct, zvalue_struct, zvalue_string_struct, zvalue_obj_struct;
LLVMTypeRef zval_struct_types[4], zvalue_struct_types[1], zvalue_string_struct_types[2], zvalue_obj_struct_types[2];
if (context->types.zval_type != NULL) {
return 0;
}
zval_struct = LLVMStructCreateNamed(LLVMGetGlobalContext(), "%struct._zval_struct");
zvalue_string_struct = LLVMStructCreateNamed(LLVMGetGlobalContext(), "%struct.zvalue_str"); // struct {
zvalue_string_struct_types[0] = LLVMPointerType(LLVMInt8Type(), 0); // char *val;
zvalue_string_struct_types[1] = LLVMInt32Type(); // int len;
LLVMStructSetBody(zvalue_string_struct, zvalue_string_struct_types, 2, 0);
zvalue_obj_struct = LLVMStructCreateNamed(LLVMGetGlobalContext(), "%struct.zvalue_obj"); // struct {
zvalue_obj_struct_types[0] = LLVMInt32Type(); // int len;
zvalue_obj_struct_types[1] = LLVMPointerType(LLVMInt8Type(), 0); // char *val;
LLVMStructSetBody(zvalue_obj_struct, zvalue_obj_struct_types, 2, 0);
zvalue_struct = LLVMStructCreateNamed(LLVMGetGlobalContext(), "%union._zvalue_value");
#if ZEPHIR_32
zvalue_struct_types[0] = LLVMDoubleType(); // double dval; /* double value */
#else
zvalue_struct_types[0] = zvalue_string_struct; // { char *val, int len }
#endif
//zvalue_struct_types[2] = zvalue_string_struct; // char *val;
//zvalue_struct_types[3] = LLVMPointerType(LLVMInt8Type(), 0); // HashTable *ht; /* hash table value */
//zvalue_struct_types[4] = zvalue_obj_struct; // zend_object_value obj;
LLVMStructSetBody(zvalue_struct, zvalue_struct_types, 1, 0);
zval_struct_types[0] = zvalue_struct;
zval_struct_types[1] = LLVMInt32Type();
zval_struct_types[2] = LLVMInt8Type();
zval_struct_types[3] = LLVMInt8Type();
LLVMStructSetBody(zval_struct, zval_struct_types, 4, 0);
context->types.zval_type = zval_struct;
context->types.zval_pointer_type = LLVMPointerType(zval_struct, 0);
context->types.zval_double_pointer_type = LLVMPointerType(context->types.zval_pointer_type, 0);
context->types.zvalue_type = zvalue_struct;
return 1;
}
/**
* Builds a call to 'emalloc'
*/
void zephir_build_emalloc(zephir_context *context, LLVMTypeRef type, size_t size, LLVMValueRef value_ref) {
LLVMValueRef function, args[3], bitcast, alloc;
LLVMTypeRef arg_tys[3];
function = LLVMGetNamedFunction(context->module, "emalloc");
if (!function) {
#if ZEPHIR_32
arg_tys[0] = LLVMInt32Type();
#else
arg_tys[0] = LLVMInt64Type();
#endif
arg_tys[1] = LLVMPointerType(LLVMInt8Type(), 0);
arg_tys[2] = LLVMInt32Type();
function = LLVMAddFunction(context->module, "emalloc", LLVMFunctionType(LLVMPointerType(LLVMInt8Type(), 0), arg_tys, 3, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register emalloc");
}
LLVMAddGlobalMapping(context->engine, function, _emalloc);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
#if ZEPHIR_32
args[0] = LLVMConstInt(LLVMInt32Type(), size, 0);
#else
args[0] = LLVMConstInt(LLVMInt64Type(), size, 0);
#endif
args[1] = LLVMBuildGlobalStringPtr(context->builder, "hello", "");
args[2] = LLVMConstInt(LLVMInt32Type(), 1, 0);
alloc = LLVMBuildCall(context->builder, function, args, 3, ""); // call i8* @_emalloc(i64 24, i8* getelementptr inbounds ([1 x i8]* @.str2, i32 0, i32 0), i32 1)
bitcast = LLVMBuildBitCast(context->builder, alloc, type, ""); // bitcast i8* %6 to %struct._zval_struct*
LLVMBuildStore(context->builder, bitcast, value_ref); // store %struct._zval_struct* %7, %struct._zval_struct** %p, align 8
}
/**
* Builds a call to 'zval_dtor'
*/
void zephir_build_zval_dtor(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[1], bitcast, alloc;
LLVMTypeRef arg_tys[1];
function = LLVMGetNamedFunction(context->module, "zval_dtor");
if (!function) {
arg_tys[0] = context->types.zval_pointer_type;
function = LLVMAddFunction(context->module, "zval_dtor", LLVMFunctionType(LLVMVoidType(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zval_dtor");
}
LLVMAddGlobalMapping(context->engine, function, _zval_dtor);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = LLVMBuildLoad(context->builder, value_ref, "");
LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to 'zval_ptr_dtor'
*/
void zephir_build_zval_ptr_dtor(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[1], bitcast, alloc;
LLVMTypeRef arg_tys[1];
function = LLVMGetNamedFunction(context->module, "zval_ptr_dtor");
if (!function) {
arg_tys[0] = context->types.zval_double_pointer_type;
function = LLVMAddFunction(context->module, "zval_ptr_dtor", LLVMFunctionType(LLVMVoidType(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zval_ptr_dtor");
}
LLVMAddGlobalMapping(context->engine, function, _zval_ptr_dtor);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = value_ref;
LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to Z_ADDREF_P()
*/
void zephir_build_zval_addref(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 1, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 1
LLVMBuildStore(context->builder, // store i32 %7, i32* %a, align 4
LLVMBuildAdd( // add i32 %8, 1
context->builder,
LLVMBuildLoad(context->builder, ref, ""), // load i32* %a, align 4
LLVMConstInt(LLVMInt32Type(), 1, 0),
""
),
ref
);
}
/**
* Builds a call to Z_DELREF_P()
*/
void zephir_build_zval_delref(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 1, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 1
LLVMBuildStore(context->builder, // store i32 %7, i32* %a, align 4
LLVMBuildAdd( // add i32 %8, -1
context->builder,
LLVMBuildLoad(context->builder, ref, ""), // load i32* %a, align 4
LLVMConstInt(LLVMInt32Type(), -1, 0),
""
),
ref
);
}
/**
* Builds a call to Z_SET_REFCOUNT_P()
*/
void zephir_build_zval_set_refcount(zephir_context *context, LLVMValueRef symbol_ref, LLVMValueRef value) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 1, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 1
LLVMBuildStore(context->builder, value, ref);
}
/**
* Builds a call to Z_UNSET_ISREF_P()
*/
void zephir_build_zval_unset_isref(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 3, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 1
LLVMBuildStore(context->builder, LLVMConstInt(LLVMInt8Type(), 0, 0), ref);
}
/**
* Builds a call to Z_REFCOUNT_P()
*/
LLVMValueRef zephir_build_zval_refcount(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 1, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 1
return LLVMBuildLoad(context->builder, ref, ""); //load i32* %7, align 4
}
/**
* Builds a call to 'zephir_grow_stack'
*/
void zephir_build_memory_grow_stack(zephir_context *context) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
//zephirt_memory_grow_stack(TSRMLS_C)
function = LLVMGetNamedFunction(context->module, "zephirt_memory_grow_stack");
if (!function) {
function = LLVMAddFunction(context->module, "zephirt_memory_grow_stack", LLVMFunctionType(LLVMVoidType(), NULL, 0, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephirt_memory_grow_stack");
}
LLVMAddGlobalMapping(context->engine, function, zephirt_memory_grow_stack);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
LLVMBuildCall(context->builder, function, NULL, 0, "");
}
/**
* Builds a call to 'zephir_grow_stack'
*/
void zephir_build_memory_restore_stack(zephir_context *context) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
//zephirt_memory_restore_stack(TSRMLS_C)
function = LLVMGetNamedFunction(context->module, "zephirt_memory_restore_stack");
if (!function) {
function = LLVMAddFunction(context->module, "zephirt_memory_restore_stack", LLVMFunctionType(LLVMVoidType(), NULL, 0, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephirt_memory_restore_stack");
}
LLVMAddGlobalMapping(context->engine, function, zephirt_memory_restore_stack);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
LLVMBuildCall(context->builder, function, NULL, 0, "");
}
/**
* Builds a call to 'zephir_memory_alloc'
*/
void zephir_build_memory_alloc(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zephirt_memory_alloc");
if (!function) {
arg_tys[0] = context->types.zval_double_pointer_type;
function = LLVMAddFunction(context->module, "zephirt_memory_alloc", LLVMFunctionType(LLVMVoidType(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephirt_memory_alloc");
}
LLVMAddGlobalMapping(context->engine, function, zephirt_memory_alloc);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = value_ref;
LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to 'zephir_memory_observe'
*/
void zephir_build_memory_observe(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zephirt_memory_observe");
if (!function) {
arg_tys[0] = context->types.zval_double_pointer_type;
function = LLVMAddFunction(context->module, "zephirt_memory_observe", LLVMFunctionType(LLVMVoidType(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephirt_memory_observe");
}
LLVMAddGlobalMapping(context->engine, function, zephirt_memory_observe);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = value_ref;
LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to 'zephir_memory_nalloc'
*/
void zephir_build_memory_nalloc(zephir_context *context, LLVMValueRef value_ref) {
LLVMBasicBlockRef then_block1, else_block1, merge_block1, then_block2, else_block2, merge_block2;
LLVMValueRef current_function;
current_function = LLVMGetBasicBlockParent(LLVMGetInsertBlock(context->builder));
then_block1 = LLVMAppendBasicBlock(current_function, "then");
else_block1 = LLVMAppendBasicBlock(current_function, "else");
merge_block1 = LLVMAppendBasicBlock(current_function, "merge-if");
/**
* Check if the pointer is not NULL
*/
LLVMBuildCondBr(context->builder, LLVMBuildIsNotNull(context->builder, LLVMBuildLoad(context->builder, value_ref, ""), ""), then_block1, else_block1);
LLVMPositionBuilderAtEnd(context->builder, then_block1);
{
then_block2 = LLVMAppendBasicBlock(current_function, "then");
else_block2 = LLVMAppendBasicBlock(current_function, "else");
merge_block2 = LLVMAppendBasicBlock(current_function, "merge-if");
/**
* Check if the refcount is greater than 1
*/
LLVMBuildCondBr(context->builder,
LLVMBuildICmp(
context->builder,
LLVMIntUGT,
zephir_build_zval_refcount(context, value_ref),
LLVMConstInt(LLVMInt32Type(), 1, 0),
""
),
then_block2,
else_block2
);
LLVMPositionBuilderAtEnd(context->builder, then_block2);
/**
* Reduce the refcount
*/
zephir_build_zval_delref(context, value_ref);
/**
* Realloc the pointer
*/
zephir_build_emalloc(context, context->types.zval_pointer_type, sizeof(zval), value_ref);
/**
* Reset refcount to 1
*/
zephir_build_zval_set_refcount(context, value_ref, LLVMConstInt(LLVMInt32Type(), 1, 0));
/**
* Mark zval as not reference
*/
zephir_build_zval_unset_isref(context, value_ref);
LLVMBuildBr(context->builder, merge_block2);
then_block2 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, else_block2);
/**
* Destroy the body of the zval
*/
zephir_build_zval_dtor(context, value_ref);
LLVMBuildBr(context->builder, merge_block2);
else_block2 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, merge_block2);
/**
* Initialize variable to null
*/
zephir_build_zval_null(context, value_ref);
}
LLVMBuildBr(context->builder, merge_block1);
then_block1 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, else_block1);
/**
* Variable does not have memory and it is not tracked
*/
zephir_build_memory_alloc(context, value_ref);
LLVMBuildBr(context->builder, merge_block1);
else_block1 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, merge_block1);
}
/**
* Builds a ZEPHIR_CPY_WRT call
*/
void zephir_build_copy_on_write(zephir_context *context, LLVMValueRef symbol_ref, LLVMValueRef value_ref)
{
LLVMBasicBlockRef then_block1, else_block1, merge_block1, then_block2, else_block2, merge_block2;
LLVMValueRef current_function;
current_function = LLVMGetBasicBlockParent(LLVMGetInsertBlock(context->builder));
then_block1 = LLVMAppendBasicBlock(current_function, "then");
else_block1 = LLVMAppendBasicBlock(current_function, "else");
merge_block1 = LLVMAppendBasicBlock(current_function, "merge-if");
/**
* Check if the pointer is not NULL
*/
LLVMBuildCondBr(context->builder, LLVMBuildIsNotNull(context->builder, LLVMBuildLoad(context->builder, symbol_ref, ""), ""), then_block1, else_block1);
LLVMPositionBuilderAtEnd(context->builder, then_block1);
{
then_block2 = LLVMAppendBasicBlock(current_function, "then");
else_block2 = LLVMAppendBasicBlock(current_function, "else");
merge_block2 = LLVMAppendBasicBlock(current_function, "merge-if");
/**
* Check if the refcount is greater than 1
*/
LLVMBuildCondBr(context->builder,
LLVMBuildICmp(
context->builder,
LLVMIntUGT,
zephir_build_zval_refcount(context, symbol_ref),
LLVMConstInt(LLVMInt32Type(), 0, 0),
""
),
then_block2,
else_block2
);
LLVMPositionBuilderAtEnd(context->builder, then_block2);
/**
* Reduce refcount or destroy zval
*/
zephir_build_zval_ptr_dtor(context, symbol_ref);
LLVMBuildBr(context->builder, merge_block2);
then_block2 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, else_block2);
LLVMBuildBr(context->builder, merge_block2);
else_block2 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, merge_block2);
}
LLVMBuildBr(context->builder, merge_block1);
then_block1 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, else_block1);
/**
* Variable does not have memory and it is not tracked
*/
zephir_build_memory_observe(context, symbol_ref);
LLVMBuildBr(context->builder, merge_block1);
else_block1 = LLVMGetInsertBlock(context->builder);
LLVMPositionBuilderAtEnd(context->builder, merge_block1);
/**
* Increase refcount of value
*/
zephir_build_zval_addref(context, value_ref);
// load %struct._zval_struct** %2, align 8
LLVMBuildStore(context->builder, LLVMBuildLoad(context->builder, value_ref, ""), symbol_ref); // store i64 5000, i64* %8, align 8
}
/**
* Builds a call to zend_is_true()
*/
LLVMValueRef zephir_build_zend_is_true(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zend_is_true");
if (!function) {
arg_tys[0] = context->types.zval_pointer_type;
function = LLVMAddFunction(context->module, "zend_is_true", LLVMFunctionType(LLVMInt32Type(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zend_is_true");
}
LLVMAddGlobalMapping(context->engine, function, zend_is_true);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = LLVMBuildLoad(context->builder, value_ref, "");
return LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to ZVAL_NULL()
*/
void zephir_build_zval_null(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef indicest[2];
LLVMValueRef ref, ptr;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
LLVMBuildStore(context->builder, LLVMConstInt(LLVMInt8Type(), IS_NULL, 0), ref); // store i8 1, i8* %7, align 1
}
/**
* Builds a call to ZVAL_LONG()
*/
void zephir_build_zval_long(zephir_context *context, LLVMValueRef symbol_ref, LLVMValueRef value_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
LLVMBuildStore(context->builder, LLVMConstInt(LLVMInt8Type(), IS_LONG, 0), ref); // store i8 1, i8* %7, align 1
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
#if ZEPHIR_32
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt32Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i32*
LLVMBuildStore(context->builder, value_ref, bitcast); // store i32 5000, i32* %8, align 8
#else
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt64Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i64*
LLVMBuildStore(context->builder, value_ref, bitcast); // store i64 5000, i64* %8, align 8
#endif
}
/**
* Builds a call to ZVAL_DOUBLE()
*/
void zephir_build_zval_double(zephir_context *context, LLVMValueRef symbol_ref, LLVMValueRef value_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
LLVMBuildStore(context->builder, LLVMConstInt(LLVMInt8Type(), IS_DOUBLE, 0), ref); // store i8 1, i8* %7, align 1
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMDoubleType(), 0), ""); //bitcast %union._zvalue_value* %5 to double*
LLVMBuildStore(context->builder, value_ref, bitcast); // store i64 5000, i64* %8, align 8
}
/**
* Builds a call to ZVAL_BOOL()
*/
void zephir_build_zval_bool(zephir_context *context, LLVMValueRef symbol_ref, LLVMValueRef value_ref) {
LLVMValueRef indicest[2], indices[2];
LLVMValueRef ref, ptr, bitcast, cast;
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
LLVMBuildStore(context->builder, LLVMConstInt(LLVMInt8Type(), IS_BOOL, 0), ref); // store i8 1, i8* %7, align 1
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 0
#if ZEPHIR_32
cast = LLVMBuildZExt(context->builder, value_ref, LLVMInt32Type(), ""); // zext i8 %4 to i32 //zext i8 %8 to i64
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt32Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i32*
LLVMBuildStore(context->builder, cast, bitcast); // store i32 5000, i32* %8, align 8
#else
cast = LLVMBuildZExt(context->builder, value_ref, LLVMInt64Type(), ""); // zext i8 %4 to i32 //zext i8 %8 to i64
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt64Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i64*
LLVMBuildStore(context->builder, cast, bitcast); // store i64 5000, i64* %8, align 8
#endif
}
/**
* Builds a call to zephir_build_zephir_get_intval_ex
*/
LLVMValueRef zephir_build_zephir_get_intval_ex(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zephir_get_intval_ex");
if (!function) {
arg_tys[0] = context->types.zval_pointer_type;
#if ZEPHIR_32
function = LLVMAddFunction(context->module, "zephir_get_intval_ex", LLVMFunctionType(LLVMInt32Type(), arg_tys, 1, 0));
#else
function = LLVMAddFunction(context->module, "zephir_get_intval_ex", LLVMFunctionType(LLVMInt64Type(), arg_tys, 1, 0));
#endif
if (!function) {
zend_error(E_ERROR, "Cannot register zephir_get_intval_ex");
}
LLVMAddGlobalMapping(context->engine, function, zephir_get_intval_ex);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = LLVMBuildLoad(context->builder, value_ref, "");
return LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to zephir_build_zephir_get_boolval_ex
*/
LLVMValueRef zephir_build_zephir_get_boolval_ex(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zephir_get_boolval_ex");
if (!function) {
arg_tys[0] = context->types.zval_pointer_type;
function = LLVMAddFunction(context->module, "zephir_get_boolval_ex", LLVMFunctionType(LLVMInt8Type(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephir_get_intval_ex");
}
LLVMAddGlobalMapping(context->engine, function, zephir_get_intval_ex);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = LLVMBuildLoad(context->builder, value_ref, "");
return LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to zephir_build_zephir_get_doubleval_ex
*/
LLVMValueRef zephir_build_zephir_get_doubleval_ex(zephir_context *context, LLVMValueRef value_ref) {
LLVMValueRef function, args[2];
LLVMTypeRef arg_tys[2];
function = LLVMGetNamedFunction(context->module, "zephir_get_doubleval_ex");
if (!function) {
arg_tys[0] = context->types.zval_pointer_type;
function = LLVMAddFunction(context->module, "zephir_get_doubleval_ex", LLVMFunctionType(LLVMDoubleType(), arg_tys, 1, 0));
if (!function) {
zend_error(E_ERROR, "Cannot register zephir_get_doubleval_ex");
}
LLVMAddGlobalMapping(context->engine, function, zephir_get_doubleval_ex);
LLVMSetFunctionCallConv(function, LLVMCCallConv);
LLVMAddFunctionAttr(function, LLVMNoUnwindAttribute);
}
args[0] = LLVMBuildLoad(context->builder, value_ref, "");
return LLVMBuildCall(context->builder, function, args, 1, "");
}
/**
* Builds a call to zephir_get_intval
*/
LLVMValueRef zephir_build_get_intval(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef ptr, type, ref, cast, condition, then_value, else_value, bitcast, phi;
LLVMValueRef indicest[2], indices[2];
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
type = LLVMBuildLoad(context->builder, ref, ""); // load i8* %3, align 1
cast = LLVMBuildZExt(context->builder, type, LLVMInt32Type(), ""); // zext i8 %4 to i32
condition = LLVMBuildICmp(context->builder, LLVMIntEQ, // icmp eq i32 %5, 1
cast,
LLVMConstInt(LLVMInt32Type(), IS_LONG, 0),
""
);
LLVMValueRef func = LLVMGetBasicBlockParent(LLVMGetInsertBlock(context->builder));
LLVMBasicBlockRef then_block = LLVMAppendBasicBlock(func, "then");
LLVMBasicBlockRef else_block = LLVMAppendBasicBlock(func, "else");
LLVMBasicBlockRef merge_block = LLVMAppendBasicBlock(func, "merge-if");
LLVMBuildCondBr(context->builder, condition, then_block, else_block); // br i1 %6, label %7, label %12
/**
* Return zvalue.lval member
*/
LLVMPositionBuilderAtEnd(context->builder, then_block);
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %1, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
#if ZEPHIR_32
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt32Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i32*
#else
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt64Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i64*
#endif
then_value = LLVMBuildLoad(context->builder, bitcast, ""); // load i64* %10, align 8
LLVMBuildBr(context->builder, merge_block);
then_block = LLVMGetInsertBlock(context->builder);
/**
* Or, call zephir_get_intval_ex
*/
LLVMPositionBuilderAtEnd(context->builder, else_block);
else_value = zephir_build_zephir_get_intval_ex(context, symbol_ref);
LLVMBuildBr(context->builder, merge_block);
else_block = LLVMGetInsertBlock(context->builder);
/**
* Merge the resulting value using a phi
*/
LLVMPositionBuilderAtEnd(context->builder, merge_block);
#if ZEPHIR_32
phi = LLVMBuildPhi(context->builder, LLVMInt32Type(), ""); //phi i64 [ %11, %7 ], [ %14, %12 ]
#else
phi = LLVMBuildPhi(context->builder, LLVMInt64Type(), ""); //phi i64 [ %11, %7 ], [ %14, %12 ]
#endif
LLVMAddIncoming(phi, &then_value, &then_block, 1);
LLVMAddIncoming(phi, &else_value, &else_block, 1);
return phi;
}
/**
* Builds a call to zephir_get_boolval
*/
LLVMValueRef zephir_build_get_boolval(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef ptr, type, ref, cast, condition, then_value, else_value, bitcast, phi, boolval_ex;
LLVMValueRef indicest[2], indices[2];
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
type = LLVMBuildLoad(context->builder, ref, ""); // load i8* %3, align 1
cast = LLVMBuildZExt(context->builder, type, LLVMInt32Type(), ""); // zext i8 %4 to i32
condition = LLVMBuildICmp(context->builder, LLVMIntEQ, // icmp eq i32 %5, 1
cast,
LLVMConstInt(LLVMInt32Type(), IS_BOOL, 0),
""
);
LLVMValueRef func = LLVMGetBasicBlockParent(LLVMGetInsertBlock(context->builder));
LLVMBasicBlockRef then_block = LLVMAppendBasicBlock(func, "then");
LLVMBasicBlockRef else_block = LLVMAppendBasicBlock(func, "else");
LLVMBasicBlockRef merge_block = LLVMAppendBasicBlock(func, "merge-if");
LLVMBuildCondBr(context->builder, condition, then_block, else_block); // br i1 %6, label %7, label %12
/**
* Return zvalue.lval member
*/
LLVMPositionBuilderAtEnd(context->builder, then_block);
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %1, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
#if ZEPHIR_32
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt32Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i32*
#else
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMInt64Type(), 0), ""); //bitcast %union._zvalue_value* %7 to i64*
#endif
then_value = LLVMBuildLoad(context->builder, bitcast, ""); // load i64* %10, align 8
LLVMBuildBr(context->builder, merge_block);
then_block = LLVMGetInsertBlock(context->builder);
/**
* Or, call zephir_get_boolval_ex
*/
LLVMPositionBuilderAtEnd(context->builder, else_block);
boolval_ex = zephir_build_zephir_get_boolval_ex(context, symbol_ref);
#if ZEPHIR_32
else_value = LLVMBuildZExt(context->builder, boolval_ex, LLVMInt32Type(), ""); // zext i8 %18 to i64
#else
else_value = LLVMBuildZExt(context->builder, boolval_ex, LLVMInt64Type(), ""); // zext i8 %18 to i64
#endif
LLVMBuildBr(context->builder, merge_block);
else_block = LLVMGetInsertBlock(context->builder);
/**
* Merge the resulting value using a phi
*/
LLVMPositionBuilderAtEnd(context->builder, merge_block);
#if ZEPHIR_32
phi = LLVMBuildPhi(context->builder, LLVMInt32Type(), ""); //phi i64 [ %11, %7 ], [ %14, %12 ]
#else
phi = LLVMBuildPhi(context->builder, LLVMInt64Type(), ""); //phi i64 [ %11, %7 ], [ %14, %12 ]
#endif
LLVMAddIncoming(phi, &then_value, &then_block, 1);
LLVMAddIncoming(phi, &else_value, &else_block, 1);
return LLVMBuildTrunc(context->builder, phi, LLVMInt8Type(), "");
}
/**
* Builds a call to zephir_get_doubleval
*/
LLVMValueRef zephir_build_get_doubleval(zephir_context *context, LLVMValueRef symbol_ref) {
LLVMValueRef ptr, type, ref, cast, condition, then_value, else_value, bitcast, phi;
LLVMValueRef indicest[2], indices[2];
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %2, align 8
indicest[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indicest[1] = LLVMConstInt(LLVMInt32Type(), 2, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indicest, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
type = LLVMBuildLoad(context->builder, ref, ""); // load i8* %3, align 1
cast = LLVMBuildZExt(context->builder, type, LLVMInt32Type(), ""); // zext i8 %4 to i32
condition = LLVMBuildICmp(context->builder, LLVMIntEQ, // icmp eq i32 %5, 1
cast,
LLVMConstInt(LLVMInt32Type(), IS_DOUBLE, 0),
""
);
LLVMValueRef func = LLVMGetBasicBlockParent(LLVMGetInsertBlock(context->builder));
LLVMBasicBlockRef then_block = LLVMAppendBasicBlock(func, "then");
LLVMBasicBlockRef else_block = LLVMAppendBasicBlock(func, "else");
LLVMBasicBlockRef merge_block = LLVMAppendBasicBlock(func, "merge-if");
LLVMBuildCondBr(context->builder, condition, then_block, else_block); // br i1 %6, label %7, label %12
/**
* Return zvalue.dval member if type is IS_DOUBLE
*/
LLVMPositionBuilderAtEnd(context->builder, then_block);
ptr = LLVMBuildLoad(context->builder, symbol_ref, ""); // load %struct._zval_struct** %1, align 8
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
ref = LLVMBuildInBoundsGEP(context->builder, ptr, indices, 2, ""); // getelementptr inbounds %struct._zval_struct* %6, i32 0, i32 2
bitcast = LLVMBuildBitCast(context->builder, ref, LLVMPointerType(LLVMDoubleType(), 0), ""); //bitcast %union._zvalue_value* %7 to double*
then_value = LLVMBuildLoad(context->builder, bitcast, ""); // load i64* %10, align 8
LLVMBuildBr(context->builder, merge_block);
then_block = LLVMGetInsertBlock(context->builder);
/**
* Or, call zephir_get_doubleval_ex
*/
LLVMPositionBuilderAtEnd(context->builder, else_block);
else_value = zephir_build_zephir_get_doubleval_ex(context, symbol_ref);
LLVMBuildBr(context->builder, merge_block);
else_block = LLVMGetInsertBlock(context->builder);
/**
* Merge the resulting value using a phi
*/
LLVMPositionBuilderAtEnd(context->builder, merge_block);
phi = LLVMBuildPhi(context->builder, LLVMDoubleType(), ""); //phi i64 [ %11, %7 ], [ %14, %12 ]
LLVMAddIncoming(phi, &then_value, &then_block, 1);
LLVMAddIncoming(phi, &else_value, &else_block, 1);
return phi;
}
/**
* Builds a RETURN_LONG
*/
void zephir_build_return_long(zephir_context *context, LLVMValueRef value_ref, zval *location) {
zephir_variable *symbol_variable;
symbol_variable = zephir_symtable_get_variable_for_read(context->symtable, SL("return_value"), context, location);
zephir_build_zval_long(context, symbol_variable->value_ref, value_ref);
}
/**
* Builds a RETURN_DOUBLE
*/
void zephir_build_return_double(zephir_context *context, LLVMValueRef value_ref, zval *location) {
zephir_variable *symbol_variable;
symbol_variable = zephir_symtable_get_variable_for_read(context->symtable, SL("return_value"), context, location);
zephir_build_zval_double(context, symbol_variable->value_ref, value_ref);
}
/**
* Builds a RETURN_BOOL
*/
void zephir_build_return_bool(zephir_context *context, LLVMValueRef value_ref, zval *location) {
zephir_variable *symbol_variable;
symbol_variable = zephir_symtable_get_variable_for_read(context->symtable, SL("return_value"), context, location);