arrays
R=r
OCL=14603
CL=14603
diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h
index b8ddcc3..02e1581 100644
--- a/src/cmd/gc/go.h
+++ b/src/cmd/gc/go.h
@@ -3,11 +3,6 @@
// license that can be found in the LICENSE file.
/*
-todo:
- 1. dyn arrays
- 2. multi
-tothinkabout:
- 2. argument in import
*/
#include <u.h>
@@ -55,6 +50,21 @@
char s[3]; // variable
};
+/*
+ * note this is the runtime representation
+ * of the compilers arrays. it is probably
+ * insafe to use it this way, but it puts
+ * all the changes in one place.
+ */
+typedef struct Array Array;
+struct Array
+{ // must not move anything
+ uchar array[8]; // pointer to data
+ uint32 nel; // number of elements
+ uint32 cap; // allocated number of elements
+ uchar b; // actual array - may not be contig
+};
+
enum
{
Mpscale = 29, /* safely smaller than bits in a long */
@@ -131,6 +141,7 @@
// TARRAY
int32 bound;
+ Node* dbound;
};
#define T ((Type*)0)
@@ -251,7 +262,7 @@
ORETURN, OFOR, OIF, OSWITCH, OI2S, OS2I, OI2I,
OAS, OASOP, OCASE, OXCASE, OSCASE, OFALL, OXFALL,
OGOTO, OPROC, ONEW, OEMPTY, OSELECT,
- OLEN, OPANIC, OPRINT, OTYPEOF,
+ OLEN, OCAP, OPANIC, OPRINT, OTYPEOF,
OOROR,
OANDAND,
@@ -669,6 +680,7 @@
Node* mapop(Node*, int);
Type* fixchan(Type*);
Node* chanop(Node*, int);
+Node* arrayop(Node*, int);
Node* isandss(Type*, Node*);
Node* convas(Node*);
void arrayconv(Type*, Node*);