summary refs log tree commit diff stats
path: root/compiler/ccgcalls.nim
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'devel' into new-llAndreas Rumpf2016-01-141-0/+8
|\
| * fixed #2240 and #3586andri lim2016-01-051-0/+8
| |
* | fixes #2659Andreas Rumpf2016-01-041-2/+2
|/
* fixes #3144Araq2015-07-261-19/+19
|
* importing of C++ nested generics like std::vector<T>::iterator, using the ↵Zahary Karadjov2015-04-131-10/+3
| | | | apostrophe operator
* Get rid of deprecation warningsdef2015-04-071-87/+87
|
* compiler_ropes: ropeToStr -> $Jacek Sieka2015-04-011-2/+2
|
* bugfixes for C++ codegenAraq2015-04-011-2/+28
|
* fixes #1717, fixes #2324Araq2015-03-221-1/+4
|
* fixes #2266Araq2015-03-221-1/+1
|
* fixes #2336Araq2015-03-161-1/+2
|
* bugfix: c++ pattern #@ could index out of boundsAraq2015-03-101-5/+6
|
* fixes #2199, fixes #2197Araq2015-02-241-1/+1
|
* fixes #2068Araq2015-02-121-9/+21
|
* fixes c++ codegen regressionAraq2015-02-071-1/+1
|
* lots of C++ codegen improvementsAraq2015-02-071-8/+16
|
* C++ support: codegen generates C++'s references and avoids copiesAraq2015-02-041-26/+50
|
* bugfixes for the new C++ patternsAraq2015-01-231-8/+7
|
* better C++ support wrt 'this'Araq2015-01-181-20/+90
|
* patterns for 'importcpp' (still undocumented)Araq2015-01-141-27/+91
|
* handle 'T&' properly for better C++ supportAraq2015-01-131-3/+11
|
* implemented mixed mode codegenAraq2014-10-031-2/+2
|
* Nimrod renamed to NimAraq2014-08-281-1/+1
|
* fixes #1434Araq2014-08-141-6/+7
|
* tdisjoint_slice2 worksAraq2014-05-311-1/+1
|
* implemented builtin noncopying sliceAraq2014-05-021-12/+32
|
* more efficient calls for closure iteratorsAraq2014-01-251-3/+5
|
* 'nil' as a statement is deprecated, use an empty 'discard' insteadAraq2014-01-191-1/+1
|
* case consistency part 4Araq2013-12-271-2/+2
|
* implemented 'injectStmt'; more debug supportAraq2013-12-161-0/+2
|
* preparations for the new symbol binding rules for clean templatesAraq2013-05-181-1/+1
|
* codegen produces better code for complex assignmentsAraq2013-02-241-1/+1
|
* merged upstream masterZahary Karadjov2013-01-271-2/+2
|\
| * fixes #299Araq2013-01-081-2/+2
| |
* | first batch of rope code converted to `rfmt`Zahary Karadjov2012-11-281-24/+24
|/ | | | | | The results so far are inconclusive: The rope cache tries have been reduced by more than 125K (nearly 20%), but the bootstrap time seems to be ever slightly increasing (0.01s).
* Improved support for nkSymChoices in type coercionsZahary Karadjov2012-10-151-10/+11
| | | | | | | | | | For example, this allows you to pick up a proc with a specific signature from an overload set. bugfix: nimrod generated invalid code when a RVO function had a single compile-time param bugfix: nkHiddenDerefs were not neutralised properly for indirect proc calls
* fixes #186 and the ttypedesc1 test caseZahary Karadjov2012-09-231-5/+5
|
* next steps for tyVarargs/tyOpenArray splitAraq2012-08-141-2/+2
|
* proper indentation in the generated C codeZahary Karadjov2012-06-121-24/+15
|
* fixes #127Araq2012-05-301-5/+10
|
* fixes #20 properlyZahary Karadjov2012-04-151-3/+0
|
* C variables are created in their enclosing block instead of their enclosing ↵Zahary Karadjov2012-04-121-16/+18
| | | | function
* typedesc and expr paramsZahary Karadjov2012-03-311-0/+1
| | | | | | | | | | | | types are now valid proc/template/macro params and you can overload over them: proc foo(T: typedesc) # accept any type proc foo(T: typedesc{int}) # overload specifically for int proc foo(T: typedesc{int or float or Callable}) # overload for any type matching the constraints expr{type} is a param expecting compile time value of the designated type (or type class). when typedesc or expr params are used with a proc, the proc will be instantiated once for each unique type/value used as parameter.
* bootstraps fine with overloadable templatesZahary Karadjov2012-03-141-1/+2
|
* further steps for closure supportAraq2012-02-061-4/+2
|
* further steps to closure supportAraq2012-02-061-3/+68
|
* fixes #89Araq2012-01-291-1/+4
|
* removed nimKeepAlive as it's not necessary with interior pointer checkingAraq2012-01-151-44/+20
|
* year 2012 for most copyright headersAraq2012-01-021-1/+1
|
* code gen can generate code to keep alive stack rootsAraq2011-12-221-2/+4
|
' href='/akkartik/mu/commit/cpp/023jump?h=main&id=88be3dbc0c996490dbac97538f4d712a5b4f6f07'>88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
201b2e6c ^
1848b18f ^

201b2e6c ^
363be37f ^
d855b0a0 ^
201b2e6c ^
d855b0a0 ^
4814bf94 ^
e4630643 ^

d855b0a0 ^
4814bf94 ^
e4630643 ^

d855b0a0 ^
4814bf94 ^
e4630643 ^

d855b0a0 ^



dc1323e9 ^
0487a30e ^
35064671 ^
201b2e6c ^

1066660e ^
35064671 ^
1066660e ^
201b2e6c ^

88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
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
                   
 


                                      
                    
 
                   
                        

                             
                                             
     
                                        
                              
                                       
            
                                    
                                                                                                                              

          
                                              
                                                                                                                                                                    

          



                                                
                                                              
                                                    
                                                                                                     
                                             

 

                                          
                           
 
                         
             
                       
                               


                               


                    
 

                                             
                                        
                                    
                                       
               
                                    
                                                                                                                                  

          
                                              
                                                                                                                                                                   

          
                                              
                                                                                                                                                                            

          



                                                
                                                              
                                 
                                                                            

          
                                                    
                                                                                                     
                                             

 
                   
             

                       
 
                           
                              
                        
                               
 
                               
             

                      
 
                         
                          
                          
                               
 

                                             
                                        
                                            
                                       
                   
                                    
                                                                                                                                      

          
                                              
                                                                                                                                                                       

          
                                              
                                                                                                                                                                                

          



                                                
                                                              
                                
                                                                                

          
                                                    
                                                                                                     
                                             

 
                       
             

                         
 
                             
                              
                          
                               
 
                                   
             

                           
 
                               
                              
                          
                               
//: Jump primitives

:(scenario jump_can_skip_instructions)
recipe main [
  jump 1:offset
  1:number <- copy 1
]
+run: jump 1:offset
-run: 1:number <- copy 1
-mem: storing 1 in location 1

:(before "End Primitive Recipe Declarations")
JUMP,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump"] = JUMP;
:(before "End Primitive Recipe Checks")
case JUMP: {
  if (SIZE(inst.ingredients) != 1) {
    raise << maybe(Recipe[r].name) << "'jump' requires exactly one ingredient, but got " << inst.to_string() << '\n' << end();
    break;
  }
  if (!is_mu_scalar(inst.ingredients.at(0))) {
    raise << maybe(Recipe[r].name) << "first ingredient of 'jump' should be a label or offset, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case JUMP: {
  assert(current_instruction().ingredients.at(0).initialized);
  current_step_index() += ingredients.at(0).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

//: special type to designate jump targets
:(before "End Mu Types Initialization")
Type_ordinal["offset"] = 0;

:(scenario jump_backward)
recipe main [
  jump 1:offset  # 0 -+
  jump 3:offset  #    |   +-+ 1
                 #   \/  /\ |
  jump -2:offset #  2 +-->+ |
]                #         \/ 3
+run: jump 1:offset
+run: jump -2:offset
+run: jump 3:offset

:(before "End Primitive Recipe Declarations")
JUMP_IF,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump-if"] = JUMP_IF;
:(before "End Primitive Recipe Checks")
case JUMP_IF: {
  if (SIZE(inst.ingredients) != 2) {
    raise << maybe(Recipe[r].name) << "'jump-if' requires exactly two ingredients, but got " << inst.to_string() << '\n' << end();
    break;
  }
  if (!is_mu_scalar(inst.ingredients.at(0))) {
    raise << maybe(Recipe[r].name) << "'jump-if' requires a boolean for its first ingredient, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  if (!is_mu_scalar(inst.ingredients.at(1))) {
    raise << maybe(Recipe[r].name) << "'jump-if' requires a label or offset for its second ingredient, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case JUMP_IF: {
  assert(current_instruction().ingredients.at(1).initialized);
  if (!ingredients.at(0).at(0)) {
    trace(Primitive_recipe_depth, "run") << "jump-if fell through" << end();
    break;
  }
  current_step_index() += ingredients.at(1).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

:(scenario jump_if)
recipe main [
  jump-if 999, 1:offset
  123:number <- copy 1
]
+run: jump-if 999, 1:offset
+run: jumping to instruction 2
-run: 1:number <- copy 1
-mem: storing 1 in location 123

:(scenario jump_if_fallthrough)
recipe main [
  jump-if 0, 1:offset
  123:number <- copy 1
]
+run: jump-if 0, 1:offset
+run: jump-if fell through
+run: 123:number <- copy 1
+mem: storing 1 in location 123

:(before "End Primitive Recipe Declarations")
JUMP_UNLESS,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump-unless"] = JUMP_UNLESS;
:(before "End Primitive Recipe Checks")
case JUMP_UNLESS: {
  if (SIZE(inst.ingredients) != 2) {
    raise << maybe(Recipe[r].name) << "'jump-unless' requires exactly two ingredients, but got " << inst.to_string() << '\n' << end();
    break;
  }
  if (!is_mu_scalar(inst.ingredients.at(0))) {
    raise << maybe(Recipe[r].name) << "'jump-unless' requires a boolean for its first ingredient, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  if (!is_mu_scalar(inst.ingredients.at(1))) {
    raise << maybe(Recipe[r].name) << "'jump-unless' requires a label or offset for its second ingredient, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case JUMP_UNLESS: {
  assert(current_instruction().ingredients.at(1).initialized);
  if (ingredients.at(0).at(0)) {
    trace(Primitive_recipe_depth, "run") << "jump-unless fell through" << end();
    break;
  }
  current_step_index() += ingredients.at(1).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

:(scenario jump_unless)
recipe main [
  jump-unless 0, 1:offset
  123:number <- copy 1
]
+run: jump-unless 0, 1:offset
+run: jumping to instruction 2
-run: 123:number <- copy 1
-mem: storing 1 in location 123

:(scenario jump_unless_fallthrough)
recipe main [
  jump-unless 999, 1:offset
  123:number <- copy 1
]
+run: jump-unless 999, 1:offset
+run: jump-unless fell through
+run: 123:number <- copy 1
+mem: storing 1 in location 123