Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Modified test scripts to use __initHeap

  • Loading branch information...
commit db58dfea6f2ff688e93e7695dcbe110d3b7ec500 1 parent 3973a79
Gabriano authored
47  src/backend/test_gc.c
@@ -13,39 +13,40 @@ char *line = "==================================================================
13 13
 
14 14
 int main(void)
15 15
 {
16  
-    allocByteField(getHeap(), __PAIRSIZE__);
  16
+    __initHeap(_A_(0));
  17
+    /* allocByteField(getHeap(), __PAIRSIZE__); */
17 18
     /* dumpWord(getHeap(), (__WORD__)__TRUE__); printf("\n"); */
18 19
     /* dumpWord(getHeap(), (__WORD__)__FALSE__); printf("\n"); */
19 20
     /* dumpWord(getHeap(), (__WORD__)__NULL__); printf("\n"); */
20 21
 
21  
-    dumpWord(getHeap(), __add(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4))); printf("\n");
  22
+    dumpWord(getHeap(), __add(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4))); printf("\n");
22 23
     
23 24
     __VAR__ p1;
24 25
     p1 = allocVar();
25 26
 
26 27
     printf(line);
27 28
     printf("Only 1 boxint var. Heap should be empty before and after gc:\n");
28  
-    setVar(p1, __boxint(_A1_, 42));
  29
+    setVar(p1, __boxint(_A_(1), 42));
29 30
     dumpByteField(getHeap());
30  
-    __gc(getHeap(), getNewHeap());
  31
+    gc_run(getHeap(), getNewHeap());
31 32
     dumpByteField(getHeap());
32 33
     printf(line);
33 34
 
34 35
     printf(line);
35 36
     printf("Only 1 boxpair var. Heap should contain the pair before and after gc:\n");
36  
-    setVar(p1, __cons(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4)));
  37
+    setVar(p1, __cons(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4)));
37 38
     dumpByteField(getHeap());
38  
-    __gc(getHeap(), getNewHeap());
  39
+    gc_run(getHeap(), getNewHeap());
39 40
     dumpByteField(getHeap());
40 41
     printf(line);
41 42
 
42 43
     printf(line);
43 44
     printf("Only 1 boxpair var but 2 more pairs created. Heap should contain 3 pairs before and 1 after gc:\n");
44  
-    setVar(p1, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
45  
-    setVar(p1, __cons(_A2_, __boxint(_A1_, 7), __boxint(_A1_, 8)));
  45
+    setVar(p1, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
  46
+    setVar(p1, __cons(_A_(2), __boxint(_A_(1), 7), __boxint(_A_(1), 8)));
46 47
 
47 48
     dumpByteField(getHeap());
48  
-    __gc(getHeap(), getNewHeap());
  49
+    gc_run(getHeap(), getNewHeap());
49 50
     dumpByteField(getHeap());
50 51
     printf(line);
51 52
 
@@ -55,22 +56,22 @@ int main(void)
55 56
     p2 = allocVar();
56 57
     p3 = allocVar();
57 58
 
58  
-    setVar(p1, __cons(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4)));
59  
-    setVar(p2, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
60  
-    setVar(p3, __cons(_A2_, __boxint(_A1_, 7), __boxint(_A1_, 8)));
  59
+    setVar(p1, __cons(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4)));
  60
+    setVar(p2, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
  61
+    setVar(p3, __cons(_A_(2), __boxint(_A_(1), 7), __boxint(_A_(1), 8)));
61 62
 
62 63
     dumpByteField(getHeap());
63  
-    __gc(getHeap(), getNewHeap());
  64
+    gc_run(getHeap(), getNewHeap());
64 65
     dumpByteField(getHeap());
65 66
     printf(line);
66 67
 
67 68
     printf(line);
68 69
     printf("3 vars. p1 == pair; p2 == vector; p3 == string. Heap should contain 5 pairs before and 3 after gc:\n");
69 70
     setVar(p3, __string("**Variable p3**"));
70  
-    setVar(p2, __vector(_A1_, __boxint(_A1_, 12)));
  71
+    setVar(p2, __vector(_A_(1), __boxint(_A_(1), 12)));
71 72
 
72 73
     dumpByteField(getHeap());
73  
-    __gc(getHeap(), getNewHeap());
  74
+    gc_run(getHeap(), getNewHeap());
74 75
     dumpByteField(getHeap());
75 76
     printf(line);
76 77
 
@@ -81,7 +82,7 @@ int main(void)
81 82
     setVar(p3, __NULL__);
82 83
 
83 84
     dumpByteField(getHeap());
84  
-    __gc(getHeap(), getNewHeap());
  85
+    gc_run(getHeap(), getNewHeap());
85 86
     dumpByteField(getHeap());
86 87
     printf(line);
87 88
 
@@ -92,15 +93,15 @@ int main(void)
92 93
     printf("p1[1] <= p2\n");
93 94
     printf("p2 <= cons(5, 6)\n");
94 95
     printf("p3 <= vector(5)\n");
95  
-    setVar(p1, __vector(_A1_, __boxint(_A1_, 3)));
96  
-    __vectorSet(_A2_, getVar(p1), __boxint(_A1_, 0), __string("Allo"));
97  
-    setVar(p2, __cons(_A2_, __boxint(_A1_, 10), __boxint(_A1_, 11)));
98  
-    __vectorSet(_A2_, getVar(p1), __boxint(_A1_, 1), getVar(p2));
99  
-    setVar(p2, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
100  
-    setVar(p3, __vector(_A1_, __boxint(_A1_, 5)));
  96
+    setVar(p1, __vector(_A_(1), __boxint(_A_(1), 3)));
  97
+    __vectorSet(_A_(2), getVar(p1), __boxint(_A_(1), 0), __string("Allo"));
  98
+    setVar(p2, __cons(_A_(2), __boxint(_A_(1), 10), __boxint(_A_(1), 11)));
  99
+    __vectorSet(_A_(2), getVar(p1), __boxint(_A_(1), 1), getVar(p2));
  100
+    setVar(p2, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
  101
+    setVar(p3, __vector(_A_(1), __boxint(_A_(1), 5)));
101 102
 
102 103
     dumpByteField(getHeap());
103  
-    __gc(getHeap(), getNewHeap());
  104
+    gc_run(getHeap(), getNewHeap());
104 105
     dumpByteField(getHeap());
105 106
     printf(line);
106 107
     
3  src/backend/test_primitives.c
@@ -10,7 +10,8 @@
10 10
 
11 11
 int main(void)
12 12
 {
13  
-    allocByteField(getHeap(), __PAIRSIZE__);
  13
+    __initHeap(_A_(0));
  14
+    /* allocByteField(getHeap(), __PAIRSIZE__); */
14 15
 
15 16
     __newline(_A_(0)); __display(_A_(1), __string("** Pair **")); __newline(_A_(0));
16 17
 

0 notes on commit db58dfe

Please sign in to comment.
Something went wrong with that request. Please try again.