about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-11-29 00:57:06 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-29 00:57:06 -0800
commitba7e56926df02be575ba772c33c8e1614f13f1f8 (patch)
treef814e3aa824a8b1ac47ed51bd6f9673099b0bbf0 /mu.arc
parentc00202cc5eeeea9b2ea5c7c7b0180f168c9ac570 (diff)
downloadmu-ba7e56926df02be575ba772c33c8e1614f13f1f8.tar.gz
379
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc24
1 files changed, 15 insertions, 9 deletions
diff --git a/mu.arc b/mu.arc
index ec681c08..d278fee6 100644
--- a/mu.arc
+++ b/mu.arc
@@ -599,7 +599,9 @@
             (= memory*.addr val))
         (do (if ((types* typeof.loc) 'array)
               ; size check for arrays
-              (when (~is rep.val.0 (- n 1))
+              (when (~is n
+                         (+ 1  ; array length
+                            (* rep.val.0 (sizeof ((types* typeof.loc) 'elem)))))
                 (die "writing invalid array @(tostring prn.val)"))
               ; size check for non-arrays
               (when (~is sizeof.loc n)
@@ -646,14 +648,18 @@
 (def sizeof (x)
   (trace "sizeof" x)
   (point return
-  (when (and (acons x)
-             (pos 'deref metadata.x))
-    (assert typeinfo.x!address)
-    (return (sizeof deref.x)))
-  (when (and (acons x)
-             typeinfo.x!array)
-    (return (+ 1 (* (m `(,v.x integer))
-                    (sizeof typeinfo.x!elem)))))
+  (when (acons x)
+;?     (tr "aa " x)
+    (zap absolutize x)
+;?     (tr "bb " x)
+    (while (pos 'deref metadata.x)
+;?       (tr "cc " x)
+      (zap deref x))
+;?     (tr "dd " x)
+;?     (trace "sizeof" "after canonizing: " x)
+    (when typeinfo.x!array
+      (return (+ 1 (* (m `(,v.x integer ,@(cut x 2)))
+                      (sizeof typeinfo.x!elem))))))
   (let type (if (and acons.x (pos 'deref metadata.x))
                   typeinfo.x!elem  ; deref pointer
                 acons.x
fic funcs into separate files' href='/gbmor/getwtxt/commit/svc/db.go?h=v0.4.5&id=a5a32e7a317dd5cf156e52a71d7be432d0594bf7'>a5a32e7 ^
439695f ^


a5a32e7 ^
78f4d8a ^
439695f ^


78f4d8a ^
e9d4a6b ^
439695f ^
439695f ^
439695f ^
1a15258 ^
439695f ^

fdd9bd0 ^








c8fddff ^

fdd9bd0 ^

1a15258 ^
c8fddff ^
e9d4a6b ^
c8fddff ^

930ef34 ^

e9d4a6b ^
c8fddff ^

fdd9bd0 ^
1a15258 ^
df8fa27 ^
c8fddff ^
c8fddff ^
e9d4a6b ^
df8fa27 ^
c8fddff ^
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