Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// CODE ///
- extern func dump( v : int64 );
- static var gval : int32 = 1;
- func _test( a : int32 ) : int32
- {
- var v : int8 = -5;
- while( v < 0 )
- {
- dump( v + a );
- v += 1;
- break 1;
- }
- return 0s8 + a + v;
- }
- func main()
- {
- gval += 123;
- gval += 456;
- dump( gval );
- dump( sizeof( uint16 ) );
- dump( sizeof( 0s8 ) );
- var dbl : float64;
- dump( sizeof( dbl ) );
- dump( _test( 1 ) );
- }
- /// BYTECODE ///
- FUNC (struct=6 op=30 opsub=0 tt=75)
- {
- name = '_test'
- bytecode:
- DECLARG <int32> a [7]
- DECLVAR <int8> v [2]
- CONST <uint8> 0 [15] : 05
- NEGATE <int32> 1 [17] <= 0 [15]
- COPY <int8> v [2] <= 1 [17]
- LABEL: lbl_0
- CONST <uint8> 2 [20] : 00
- LT <bool> 3 [23] <= v [2], 2 [20]
- JUMP_NIF: 3 ?~! lbl_1 [19]
- ADD <int32> 4 [24] <= v [2], a [7]
- FCALL <> [0] <= func:dump [1] args(1): 4 [24]
- CONST <uint8> 5 [25] : 01
- ADD <int32> v [2] <= v [2], 5 [25]
- JUMP: lbl_1
- JUMP: lbl_0
- LABEL: lbl_1
- CONST <int8> 6 [27] : 00
- ADD <int32> 7 [28] <= 6 [27], a [7]
- ADD <int32> 8 [29] <= 7 [28], v [2]
- RETURN 8 [29]
- }
- FUNC (struct=6 op=30 opsub=0 tt=75)
- {
- name = 'main'
- bytecode:
- DECLVAR <float64> dbl [12]
- CONST <uint8> 0 [15] : 7b
- GLOBGET <int32> 1 [17] <= gval
- ADD <int32> 2 [20] <= 1 [17], 0 [15]
- GLOBSET gval <= 2 [20]
- CONST <uint16> 3 [23] : ffffffc801
- GLOBGET <int32> 4 [24] <= gval
- ADD <int32> 5 [25] <= 4 [24], 3 [23]
- GLOBSET gval <= 5 [25]
- FCALL <> [0] <= func:dump [1] args(1): gval [4]
- CONST <int32> 6 [27] : 02000000
- FCALL <> [0] <= func:dump [1] args(1): 6 [27]
- CONST <int8> 7 [28] : 00
- CONST <int32> 8 [29] : 01000000
- FCALL <> [0] <= func:dump [1] args(1): 8 [29]
- CONST <int32> 9 [34] : 08000000
- FCALL <> [0] <= func:dump [1] args(1): 9 [34]
- CONST <uint8> 10 [36] : 01
- FCALL <int32> 11 [37] <= func:_test [6] args(1): 10 [36]
- FCALL <> [0] <= func:dump [1] args(1): 11 [37]
- }
- /// GENERATED C CODE ///
- Iint32 Igval = 1;
- extern void Idump( Iint64 Iv );
- Iint32 _Itest( Iint32 Ia );
- void Imain();
- Iint32 _Itest( Iint32 Ia )
- {
- Iint8 Iv;
- const Iuint8 I0 = 5;
- Iint32 I1 = -I0;
- Iv = I1;
- lbl_0:;
- const Iuint8 I2 = 0;
- Ibool I3 = Iv < I2;
- if( !I3 ) goto lbl_1;
- Iint32 I4 = Iv + Ia;
- Idump( I4 );
- const Iuint8 I5 = 1;
- Iv = Iv + I5;
- goto lbl_1;
- goto lbl_0;
- lbl_1:;
- const Iint8 I6 = 0;
- Iint32 I7 = I6 + Ia;
- Iint32 I8 = I7 + Iv;
- return I8;
- }
- void Imain()
- {
- Ifloat64 Idbl;
- const Iuint8 I0 = 123;
- Iint32 I1 = Igval;
- Iint32 I2 = I1 + I0;
- Igval = I2;
- const Iuint16 I3 = 456;
- Iint32 I4 = Igval;
- Iint32 I5 = I4 + I3;
- Igval = I5;
- Idump( Igval );
- const Iint32 I6 = 2;
- Idump( I6 );
- const Iint8 I7 = 0;
- const Iint32 I8 = 1;
- Idump( I8 );
- const Iint32 I9 = 8;
- Idump( I9 );
- const Iuint8 I10 = 1;
- Iint32 I11 = _Itest( I10 );
- Idump( I11 );
- }
- /// OUTPUT ///
- int (580)
- int (2)
- int (1)
- int (8)
- int (-4)
- int (-3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement