about summary refs log tree commit diff
path: root/src/rt/rust_internal.h
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-01-06 12:06:35 -0800
committerNiko Matsakis <niko@alum.mit.edu>2012-01-06 22:40:31 -0800
commit8506241f3a0dce3f0d24764a3ce3d16f99bcb809 (patch)
tree70d453fea82f951f06184de75d45f2ada8536e4b /src/rt/rust_internal.h
parent8e89df69de47a4f944f5c3fc249a88c5934864b2 (diff)
fix how we walk functions to match new closure fmt
Diffstat (limited to 'src/rt/rust_internal.h')
-rw-r--r--src/rt/rust_internal.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h
index 889b5f62018..b83d74f6bfe 100644
--- a/src/rt/rust_internal.h
+++ b/src/rt/rust_internal.h
@@ -241,8 +241,6 @@ struct rust_timer {
     ~rust_timer();
 };
 
-#include "rust_util.h"
-
 typedef void CDECL (glue_fn)(void *, void *,
                              const type_desc **, void *);
 typedef void CDECL (cmp_glue_fn)(void *, void *,
@@ -254,6 +252,30 @@ struct rust_shape_tables {
     uint8_t *resources;
 };
 
+struct rust_opaque_closure;
+
+// The type of functions that we spawn, which fall into two categories:
+// - the main function: has a NULL environment, but uses the void* arg
+// - unique closures of type fn~(): have a non-NULL environment, but
+//   no arguments (and hence the final void*) is harmless
+typedef void (*CDECL spawn_fn)(void*, rust_opaque_closure*, void *);
+
+// corresponds to the layout of a fn(), fn@(), fn~() etc
+struct fn_env_pair {
+    spawn_fn f;
+    rust_opaque_closure *env;
+};
+
+// corresponds the closures generated in trans_closure.rs
+struct rust_opaque_closure {
+    intptr_t ref_count;
+    const type_desc *td;
+    // The size/types of these will vary per closure, so they
+    // cannot be statically expressed.  See trans_closure.rs:
+    const type_desc *captured_tds[0];
+    // struct bound_data;
+};
+
 struct type_desc {
     // First part of type_desc is known to compiler.
     // first_param = &descs[1] if dynamic, null if static.
@@ -297,7 +319,6 @@ extern "C" type_desc *rust_clone_type_desc(type_desc*);
 // indent-tabs-mode: nil
 // c-basic-offset: 4
 // buffer-file-coding-system: utf-8-unix
-// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
 // End:
 //