Mercurial > archived > louis > epitech > mq > rathaxes
annotate FixScalarRefUnstrictBug @ 107:f42751b8ca99
Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Sun, 24 Mar 2013 21:47:39 -0700 |
parents | 976a4b87803f |
children | 3523e795bdf9 |
rev | line source |
---|---|
106
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
1 # HG changeset patch |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
2 # Parent 3f3babe6040fc925e39353a4b36270ae100f7f6b |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
3 Work around an unstrict cnorm bug issue concerning the function declarations. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
4 |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
5 diff --git a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
6 --- a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
7 +++ b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
8 @@ -213,9 +213,65 @@ |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
9 { rtxPH_compile<item.type>(item, compile, node_idx); } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
10 } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
11 } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
12 - // recurse param list |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
13 + // recurse param list + Resolve unknown before going down. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
14 if (existVariable(ctype_ref.param)) |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
15 - { rtxPH_compile<ctype_ref.param.type>(ctype_ref.param, compile, node_idx);} |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
16 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
17 + // XXX FIXME |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
18 + // This is a workaround for a bug involving the unstrict cnorm. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
19 + // We patch-up the function's arg's types and names before checking further. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
20 + local argnames; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
21 + foreach param in ctype_ref.param.block |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
22 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
23 + localref theType = param; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
24 + localref param_ctype = theType.ctype; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
25 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
26 + //First setup the iterator over the right param to retrieve name. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
27 + local name_it; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
28 + local it_idx = 0; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
29 + createIterator(name_it, ctype_ref.param.map); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
30 + while (it_idx != index(param)) |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
31 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
32 + next(name_it); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
33 + increment(it_idx); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
34 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
35 + local theName = key(name_it); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
36 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
37 + if (existVariable(param_ctype.unknown)) |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
38 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
39 + local placeholder_key = false; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
40 + foreach token in param_ctype.unknown |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
41 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
42 + local theKey = key(token); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
43 + if (rtxPH_havePlaceHolder(theKey)) |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
44 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
45 + placeholder_key = theKey; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
46 + break ; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
47 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
48 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
49 + if (placeholder_key == false) // no token found |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
50 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
51 + param_ctype.identifier = param_ctype.unknown#back; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
52 + removeVariable(param_ctype.unknown); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
53 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
54 + else // placeholder found -> Set as type, use other var as name. |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
55 + { |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
56 + param_ctype.identifier = placeholder_key; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
57 + removeVariable(param_ctype.unknown[placeholder_key]); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
58 + local last_it; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
59 + createReverseIterator(last_it, param_ctype.unknown); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
60 + theName = key(last_it); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
61 + removeVariable(param_ctype.unknown); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
62 + insert param.name = theName; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
63 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
64 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
65 + insert argnames[theName] = index(param); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
66 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
67 + setall ctype_ref.param.map = argnames; |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
68 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
69 + rtxPH_compile<ctype_ref.param.type>(ctype_ref.param, compile, node_idx); |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
70 + } |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
71 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
72 + |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
73 // if type is enum |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
74 if (existVariable(ctype_ref.enum)) |
976a4b87803f
Fix the resolution and the e1000 sample with the new scalar ref feature
David Pineau <dav.pineau@gmail.com>
parents:
diff
changeset
|
75 { |