summary refs log tree commit diff stats
path: root/compiler/semtypinst.nim
Commit message (Expand)AuthorAgeFilesLines
* destructors: internal compiler refactoringAraq2019-04-181-13/+12
* more destructor based changes (#10885)Andreas Rumpf2019-03-231-2/+2
* fixes #10884 (#10887)Andreas Rumpf2019-03-221-1/+1
* Size ptr tuple (#10846)Arne Döring2019-03-181-2/+1
* --newruntime: work in progressAndreas Rumpf2019-03-141-1/+1
* introduce tfHasOwned for fast must-move checkings; removed tfAcyclic as the G...Andreas Rumpf2019-03-051-5/+1
* gc:destructors: progressAndreas Rumpf2019-02-281-0/+16
* first steps in implementing 'owned' pointers; undocumented, do not useAndreas Rumpf2019-02-231-1/+1
* Propagate tfGcSafe flag to generic instantiations (#10620)LemonBoy2019-02-131-3/+2
* gc: destructors is beginning to work (#10483)Andreas Rumpf2019-01-291-13/+24
* Fix for issue #10342. better message for generic subclass instantiation (#10354)Ray Imber2019-01-221-1/+14
* Merge pull request #8748 from LemonBoy/when-in-objectsAndreas Rumpf2018-12-121-0/+40
|\
| * Pervasive replacement of nkRecWhen in generic typesLemonBoy2018-10-191-0/+40
* | IC: further progressAraq2018-12-011-1/+1
* | language cleanup: the .unchecked pragma is deadAraq2018-11-061-5/+0
* | Change the order of compilation passes, transformation is made lazy at code g...cooldome2018-10-181-0/+5
* | replace deprecated `safeAdd` with `add` (#9416)Miran2018-10-181-1/+1
* | fixes #5479Araq2018-10-021-6/+11
* | fixes #8883Araq2018-09-141-2/+5
|/
* WIP: disallow 'nil' for strings and seqsAndreas Rumpf2018-08-131-2/+2
* enable destructors without the --newruntime switchAndreas Rumpf2018-07-041-5/+1
* requested pull-request changesZahary Karadjov2018-06-161-2/+3
* fixes #7222; fixes #5595; fixes #3747Zahary Karadjov2018-06-161-12/+12
* remove more global variables in the Nim compilerAndreas Rumpf2018-05-271-9/+10
* platform.nim doesn't use globals anymore; prepare msgs.nim for not using globalsAndreas Rumpf2018-05-181-1/+1
* make tests green againAraq2018-05-141-2/+2
* guards.nim does compileAndreas Rumpf2018-05-111-22/+21
* .experimental can now be used to enable specific featuresAndreas Rumpf2018-04-241-2/+2
* Static[T] fixes (#7333)zah2018-03-241-0/+4
* preparations for language extensions: 'sink' and 'lent' typesAndreas Rumpf2018-01-071-3/+3
* fixes #6489Araq2017-11-231-2/+2
* fixes #6682Araq2017-11-221-1/+2
* deprecated unary '<'Andreas Rumpf2017-10-291-8/+8
* destructors: supportsCopyMem finally works for recursive typesAraq2017-10-261-10/+26
* destructors: irresponsibly simple tcustomseq test worksAndreas Rumpf2017-10-171-1/+4
* destructors: preparations for upcoming changesAraq2017-10-171-5/+1
* minor refactorings for better destructorsAndreas Rumpf2017-10-141-5/+11
* first implementation of the 'func' keywordAndreas Rumpf2017-09-231-1/+1
* fix #2730; fix #4880Zahary Karadjov2017-06-201-1/+2
* Fix #5962Zahary Karadjov2017-06-201-13/+44
* fixes tproctypecache_falsepositive.nim test caseAraq2017-06-081-2/+3
* fix #5683Zahary Karadjov2017-04-141-0/+1
* fix #5643; fix #5644Zahary Karadjov2017-04-081-2/+6
* Restore the Nim's 0.14 proper handling of generic aliasesZahary Karadjov2017-04-081-25/+34
* wip fix #5640Zahary Karadjov2017-04-071-1/+1
* attempt to fix #5621 #5615 generic ref object typeRel (#5633)andri lim2017-03-311-1/+1
* Working test cases for the sophisticated matrix library example from the manualZahary Karadjov2017-03-241-0/+2
* proper error reporting for concepts and the introduction of the {.explain.} p...Zahary Karadjov2017-03-241-1/+1
* infer static parameters even when more complicated arithmetic is involvedZahary Karadjov2017-03-241-2/+3
* support for inferring static[T] concept paramsZahary Karadjov2017-03-241-0/+1
Kartik K. Agaram <vc@akkartik.com> 2015-03-17 13:19:20 -0700 949 - paving the way for jumps to labels' href='/akkartik/mu/commit/cpp/012transform?h=main&id=3ba6357924e1098a28e43c94a4573a3d2978b5e9'>3ba63579 ^
9cc16d04 ^
7f73795c ^
0f125d5f ^

37e4573b ^
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
                                                                              


                                                                     









                                                                            
 
                             
                                

                                  

                     
                                             



                               

                     




                                                      

                   


                 

                      
                                                             
                                                       
                                          
                                                                                            


                                               
                             
                                                     


                              
                                        
                                                                       
                      


                           
                                                                                            
                                                                           
                                                                                          

                                  
                                                                   
                                            
                                                                  
                                               
       
                                                               
                                            





                                 
                            
                                   

                                  
 
//: Phase 2: Filter loaded recipes through an extensible list of 'transforms'.
//:
//: The hope is that this framework of transform tools will provide a
//: deconstructed alternative to conventional compilers.
//:
//: We're going to have many transforms in mu, and getting their order right
//: (not the same as ordering of layers) is a well-known problem. Some tips:
//:   a) Design each layer to rely on as few previous layers as possible.
//:
//:   b) When positioning transforms, try to find the tightest constraint in
//:   each transform relative to previous layers.
//:
//:   c) Even so you'll periodically need to try adjusting each transform
//:   relative to those in previous layers to find a better arrangement.

:(before "End recipe Fields")
long long int transformed_until;
:(before "End recipe Constructor")
transformed_until = -1;

:(before "End Types")
typedef void (*transform_fn)(recipe_ordinal);

:(before "End Globals")
vector<transform_fn> Transform;

:(after "int main")
  // Begin Transforms
    // Begin Instruction Inserting/Deleting Transforms
    // End Instruction Inserting/Deleting Transforms

    // Begin Instruction Modifying Transforms
    // End Instruction Modifying Transforms
  // End Transforms

  // Begin Checks
  // End Checks

:(code)
void transform_all() {
  trace(9990, "transform") << "=== transform_all()" << end();
  for (long long int t = 0; t < SIZE(Transform); ++t) {
//?     cerr << "transform " << t << '\n';
    for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
      recipe& r = p->second;
      if (r.steps.empty()) continue;
      if (r.transformed_until != t-1) continue;
      // End Transform Checks
      (*Transform.at(t))(/*recipe_ordinal*/p->first);
      r.transformed_until = t;
    }
  }
//?   cerr << "wrapping up transform\n";
  parse_int_reagents();  // do this after all other transforms have run
  // End Transform All
}

void parse_int_reagents() {
  trace(9991, "transform") << "--- parsing any uninitialized reagents as integers" << end();
//?   cerr << "--- parsing any uninitialized reagents as integers" << '\n';
  for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
    recipe& r = p->second;
    if (r.steps.empty()) continue;
    for (long long int index = 0; index < SIZE(r.steps); ++index) {
      instruction& inst = r.steps.at(index);
      for (long long int i = 0; i < SIZE(inst.ingredients); ++i) {
        populate_value(inst.ingredients.at(i));
      }
      for (long long int i = 0; i < SIZE(inst.products); ++i) {
        populate_value(inst.products.at(i));
      }
    }
  }
}

void populate_value(reagent& r) {
  if (r.initialized) return;
  // End Reagent-parsing Exceptions
  if (!is_integer(r.name)) return;
  r.set_value(to_integer(r.name));
}