misc: update Changelog and NOTICE; remove BUGS and TODO
[nit.git] / clib / nit_common.h
index 8bf9cfc..429e1a1 100644 (file)
@@ -122,15 +122,26 @@ extern val_t G_sys;
 extern int glob_argc;
 extern char ** glob_argv;
 
-struct trace_t {
-       struct trace_t *prev; /* previous stack frame */
-       const char *file; /* source filename */
-       int line; /* line number */
-       const char *meth; /* method name */
-       int REG_size;
-       val_t **REG_pointer;
+/* Stack frames.
+ * Are used to:
+ * - store local variables (REGS) of functions
+ * - store context for closure
+ * - provide information for stack dump
+ */
+struct stack_frame_t {
+       struct stack_frame_t *prev; /* previous stack frame */
+       const char *file; /* source filename (.nit) */
+       int line; /* line number (in the source) */
+       const char *meth; /* human function name (usually the method name) */
+       struct stack_frame_t *closure_ctx; /* closure context (for functions that have closure parameters) */
+       fun_t *closure_funs; /* closure functions (for functions that have closure parameters) */
+       int has_broke; /* has an escape occured? 0 if false, label_idx (>0) if true */
+       int REG_size; /* number of local variables */
+       val_t REG[1]; /* local variables (flexible array) */
 };
-extern struct trace_t *tracehead;
+extern struct stack_frame_t *stack_frame_head;
+
+
 typedef enum {true = (1==1),false = (0==1)} bool;
 
 void nit_exit(int);
@@ -142,8 +153,4 @@ void nit_exit(int);
 void prepare_signals(void);
 extern classtable_t TAG2VFT[4];
 
-/* This structure is used to store closure.
- * Specific closure use a specific fun parameter.
- */
-struct WBT_ {fun_t fun; val_t *has_broke; val_t broke_value; val_t *variable; struct WBT_ **closurevariable;};
 #endif