ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 09ee131 was
fcd0b9d7,
checked in by Michael Brooks <mlbrooks@…>, 4 years ago
|
PolyCost? calculation result becomes 0 or 1 per type, avoiding double-couting. Fixes #235?
PolyCost? calculation is documented as "Count of parameters and return values bound to some poly type." Before this fix, the cost calculation, looking inside one parameter or return, counted each occurrence of a poly type that it found there. This caused an incorrect increase in PolyCost? on cases like #235 where several type variables are used in the declaration of one parameter.
libcfa/src/concurrency/thread.cfa: Changing a decl-use pattern to keep resolution consistent (no behaviour is changed). The management of defaultResumptionHandler in the thread constructor was benefitting from bug #235 to disambiguate assignment to local variable vs assignment to declared function (due to #234). After this change, the code works around that false ambiguity by using a different name for the local variable.
tests/avl*: Adding a missing assertion on the custom destructor definition. Previously, the destructor definition was benefiting from bug #235 to avoid the missing-assertion-on-custom-dtor problem described in #227.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include "avl.h" |
---|
2 | // #include "cwrap.h" |
---|
3 | #include <stdlib.hfa> |
---|
4 | |
---|
5 | forall(otype K | Comparable(K), otype V) |
---|
6 | void ?{}(tree(K, V) &t, K key, V value){ |
---|
7 | (t.key) { key }; |
---|
8 | (t.value) { value }; |
---|
9 | t.parent = NULL; |
---|
10 | t.left = NULL; |
---|
11 | t.right = NULL; |
---|
12 | t.balance = 0; |
---|
13 | } |
---|
14 | |
---|
15 | forall(otype K| Comparable(K), otype V) |
---|
16 | void ^?{}(tree(K, V) & t){ |
---|
17 | delete(t.left); |
---|
18 | delete(t.right); |
---|
19 | ^(t.key){}; |
---|
20 | ^(t.value){}; |
---|
21 | } |
---|
22 | |
---|
23 | forall(otype K | Comparable(K), otype V) |
---|
24 | tree(K, V) * create(K key, V value) { |
---|
25 | // infinite loop trying to resolve ... t = malloc(); |
---|
26 | tree(K, V) * t = ( tree(K, V) * ) malloc(sizeof(tree(K,V))); |
---|
27 | (*t){ key, value }; |
---|
28 | return t; |
---|
29 | } |
---|
30 | |
---|
31 | // // Helper function to print trees |
---|
32 | // forall(otype K | Comparable(K), otype V) |
---|
33 | // void printTree(tree * t, int level){ |
---|
34 | // if (empty(t)){ |
---|
35 | // return; |
---|
36 | // } |
---|
37 | |
---|
38 | // printTree(t->left, level+1); |
---|
39 | // printf("key: %d, value: %s, level: %d\n", t->key, t->value, level); |
---|
40 | // printTree(t->right, level+1); |
---|
41 | // } |
---|
42 | |
---|
43 | // // inorder traversal of t |
---|
44 | // // prints each key, followed by the value |
---|
45 | // forall(otype K | Comparable(K), otype V) |
---|
46 | // void printTree(tree(K, V) * t){ |
---|
47 | // printTree(t, 0); |
---|
48 | // } |
---|
Note: See
TracBrowser
for help on using the repository browser.