commit 0e652da6428dbc08882120a00dc24b3242a030a9
parent d68d19323101178d18b319750358b103918e85f2
Author: Paul Longtine <paul@nanner.co>
Date: Thu, 24 Sep 2020 01:48:40 -0400
Improved runtime flexibility
Diffstat:
22 files changed, 313 insertions(+), 259 deletions(-)
diff --git a/src/lc/test_files/class.ti b/src/lc/test_files/class.ti
@@ -1,55 +0,0 @@
-class Counter:
-{
- int data = 0;
-
- func count -> int:
- {
- data = data + 1;
-
- return data;
- }
-
- func reset -> void:
- {
- data = 0;
- }
-}
-
-class ObjectFibb(Counter acc):
-{
- int a = 0;
- int b = 1;
-
- func next -> void:
- {
- b = a + b;
- a = a + b;
- }
-
- func display -> void:
- {
- print b;
- print a;
- }
-
- func run (int count) -> void:
- {
- acc.reset();
- while acc.count() < count:
- {
- next();
- display();
- }
- }
-}
-
-Counter thing = new Counter();
-
-ObjectFibb test = new ObjectFibb(thing);
-
-test.run(15);
-print "ALL DONE!";
-print test.a;
-print test.b;
-print test.acc.data;
-
diff --git a/src/lc/test_files/depthtest.ti b/src/lc/test_files/depthtest.ti
@@ -1,25 +1,17 @@
-func recurse_me_please(int i) -> int:
+include fibb;
+
+func fibbio(int target) -> int:
{
- print(i);
- if (i < 200):
+ FullFibb fibb = new FullFibb();
+
+ if target > 1:
{
- return recurse_me_please(i + 1);
+ return fibbio(target - 1) + fibbio(target - 2);
}
else:
{
- return i;
- }
-}
-
-func loop_me_please(int i) -> int:
-{
- while (i < 200):
- {
- print(i);
- i = i + 1;
+ return fibb.do(2);
}
-
- return i;
}
-print recurse_me_please(0);
+print fibbio(20);
diff --git a/src/lc/test_files/fibb.ti b/src/lc/test_files/fibb.ti
@@ -0,0 +1,70 @@
+class Adder:
+{
+ int operandA = 0;
+
+ int operandB = 0;
+
+ func doOperation -> int:
+ {
+ return operandA + operandB;
+ }
+}
+
+class Counter:
+{
+ Adder add_machine = new Adder();
+
+ add_machine.operandA = 0;
+
+ add_machine.operandB = 1;
+
+ func count -> int:
+ {
+ add_machine.operandA = add_machine.doOperation();
+ return add_machine.operandA;
+ }
+
+ func reset -> int:
+ {
+ int old_value = add_machine.operandA;
+ add_machine.operandA = 0;
+
+ return old_value;
+ }
+}
+
+class ObjectFibb(Counter acc):
+{
+ Adder add_machine = new Adder();
+
+ add_machine.operandA = 0;
+ add_machine.operandB = 1;
+
+ func next -> void:
+ {
+ add_machine.operandB = add_machine.doOperation();
+ add_machine.operandA = add_machine.doOperation();
+ }
+
+ func run (int count) -> int:
+ {
+ while acc.count() < count:
+ {
+ next();
+ }
+
+ return add_machine.operandA;
+ }
+}
+
+class FullFibb:
+{
+ Counter the_counter = new Counter();
+ ObjectFibb fibb = new ObjectFibb(the_counter);
+
+ func do (int count) -> int:
+ {
+ return fibb.run(count);
+ }
+}
+
diff --git a/src/lc/test_files/out b/src/lc/test_files/out
Binary files differ.
diff --git a/src/lc/test_files/problem.ti b/src/lc/test_files/problem.ti
@@ -1,3 +1,5 @@
+DEBUG;
+
class UsedByUsedByTesting:
{
int property_three = 3;
diff --git a/src/lc/test_files/testdirectuse.ti b/src/lc/test_files/testdirectuse.ti
@@ -0,0 +1,9 @@
+DEBUG;
+
+func test(int i) -> int:
+{
+ return i + 3;
+}
+
+print test(1 + 2) + test(3 + 4);
+
diff --git a/src/lc/main.py b/src/lc/toil
diff --git a/src/vm/Makefile b/src/vm/Makefile
@@ -1,6 +1,6 @@
SRC_DIR = src
INC_DIR = inc
-DST_DIR = /usr/bin/
+DST_DIR = /usr/local/bin/
CC = gcc
CFLAGS = -ggdb -std=c99 -Wall -I$(INC_DIR)
diff --git a/src/vm/inc/ins_def.h b/src/vm/inc/ins_def.h
@@ -16,8 +16,11 @@
#include "pc.h"
#include "helper.h"
+#define INS_DEC(op, function, description) INS_DEF[op] = function; INS_DESC[op] = description
+
// This array is populated by init_ins_def( void );
void (*INS_DEF[0x100])(rt_t*, bc_cont*);
+char* INS_DESC[0x100];
/* Initializes INS_DEF with pointers to each instructions function
* Populates INS_DEF
@@ -29,6 +32,8 @@ void init_ins_def( void );
*/
int ins_def_is_valid(bc_cont*);
+void run_ins(rt_t*, bc_cont*);
+
/* Instruction subroutines. Each subroutine takes the following arguements:
* rt_t* - Runtime context
* bc_cont* - Instruction data
diff --git a/src/vm/inc/ns.h b/src/vm/inc/ns.h
@@ -12,14 +12,14 @@
typedef unsigned int ns_addr;
typedef struct ns_cont {
- int level;
+ long level;
ns_addr size;
var_cont** names;
struct ns_cont* next;
} ns_cont;
typedef struct ns_t {
- int id;
+ long id;
ns_cont* root;
ns_cont* last;
} ns_t;
diff --git a/src/vm/inc/pc.h b/src/vm/inc/pc.h
@@ -4,7 +4,7 @@
#ifndef PC_H
#define PC_H
-#define PC_RETURN_DEPTH 0xFF
+#define PC_RETURN_DEPTH 0xFFFF
#include <stdlib.h>
#include <stdio.h>
@@ -14,13 +14,13 @@
#include "bc.h"
#include "helper.h"
-typedef unsigned short int pc_addr;
+typedef unsigned long pc_addr;
/* Address stack structure
*/
typedef struct pc_addr_stk {
- int size; // Capacity of stack
- int ptr; // Stack pointer
+ long size; // Capacity of stack
+ long ptr; // Stack pointer
pc_addr* addresses; // Stack data
} pc_addr_stk;
diff --git a/src/vm/inc/proc.h b/src/vm/inc/proc.h
@@ -8,6 +8,7 @@
#include <stdio.h>
#include "rt.h"
+#include "ins_def.h"
#include "bc.h"
#include "stk.h"
#include "var.h"
@@ -21,9 +22,12 @@
rt_t* proc_init(char*);
/* Starts execution loop for a runtime context
+ * rt_t* - Runtime context
*/
void proc_run(rt_t*);
+/* Runs exection loop until a return is reached
+ */
void proc_run_to_return(rt_t*);
/* Calls runtime context elements to free memory and terminate
diff --git a/src/vm/inc/var.h b/src/vm/inc/var.h
@@ -32,7 +32,7 @@ typedef enum {
} b_type;
typedef struct var_cont {
- int ownership;
+ long ownership;
b_type type;
void* data;
} var_cont;
diff --git a/src/vm/src/bc.c b/src/vm/src/bc.c
@@ -7,6 +7,7 @@
#include "var.h"
#include "helper.h"
#include "is.h"
+#include "ins_def.h"
/* Handles allocation for new `bc_cont` instances
*/
@@ -257,21 +258,22 @@ void bc_print_op(bc_cont* op)
unencode(op->mdata, &num_args, arg_types);
- printf("%x\t", op->op);
+ printf("%s [%x] - ", INS_DESC[op->op], op->op);
for (int i = 0; i < num_args && num_args != 0; i++)
{
if (arg_types[i] == A_BYTE)
{
- printf("%x, ", op->args[i][0]);
+ printf("I:<%02x>, ", op->args[i][0]);
} else
if (arg_types[i] == A_NAME)
{
- printf("%x %x, ", op->args[i][0], op->args[i][1]);
+ printf("N:<%02x%02x>, ", op->args[i][0], op->args[i][1]);
} else
if (arg_types[i] == A_DYNC)
{
+ printf("DYN[%02x]: ", op->sarg[i]);
for (int x = 0; x < op->sarg[i]; x++)
- printf("%x ", op->args[i][x]);
+ printf("%02x ", op->args[i][x]);
}
}
}
diff --git a/src/vm/src/ins_def.c b/src/vm/src/ins_def.c
@@ -18,77 +18,78 @@
*/
void init_ins_def( void )
{
- INS_DEF[0x00] = _ins_def_NULL;
- INS_DEF[0x01] = _ins_def_SYNC;
- INS_DEF[0x02] = _ins_def_PRINT;
- INS_DEF[0x03] = _ins_def_DEBUG;
- INS_DEF[0x0E] = _ins_def_ARGB;
- INS_DEF[0x0F] = _ins_def_LIBC;
-
- INS_DEF[0x10] = _ins_def_POP;
- INS_DEF[0x11] = _ins_def_ROT;
- INS_DEF[0x12] = _ins_def_DUP;
- INS_DEF[0x13] = _ins_def_ROT_THREE;
-
- INS_DEF[0x20] = _ins_def_DEC;
- INS_DEF[0x21] = _ins_def_LOV;
- INS_DEF[0x22] = _ins_def_STV;
- INS_DEF[0x23] = _ins_def_CTV;
- INS_DEF[0x24] = _ins_def_CTS;
-
- INS_DEF[0x30] = _ins_def_TYPEOF;
- INS_DEF[0x31] = _ins_def_CAST;
-
- INS_DEF[0x40] = _ins_def_ADD;
- INS_DEF[0x41] = _ins_def_SUB;
- INS_DEF[0x42] = _ins_def_MULT;
- INS_DEF[0x43] = _ins_def_DIV;
- INS_DEF[0x44] = _ins_def_POW;
- INS_DEF[0x45] = _ins_def_BRT;
- INS_DEF[0x46] = _ins_def_SIN;
- INS_DEF[0x47] = _ins_def_COS;
- INS_DEF[0x48] = _ins_def_TAN;
- INS_DEF[0x49] = _ins_def_ISIN;
- INS_DEF[0x4A] = _ins_def_ICOS;
- INS_DEF[0x4B] = _ins_def_ITAN;
- INS_DEF[0x4C] = _ins_def_MOD;
- INS_DEF[0x4D] = _ins_def_BOR;
- INS_DEF[0x4E] = _ins_def_BXOR;
- INS_DEF[0x4F] = _ins_def_BNAND;
-
- INS_DEF[0x50] = _ins_def_GTHAN;
- INS_DEF[0x51] = _ins_def_LTHAN;
- INS_DEF[0x52] = _ins_def_GTHAN_EQ;
- INS_DEF[0x53] = _ins_def_LTHAN_EQ;
- INS_DEF[0x54] = _ins_def_EQ;
- INS_DEF[0x55] = _ins_def_NEQ;
- INS_DEF[0x56] = _ins_def_NOT;
- INS_DEF[0x57] = _ins_def_OR;
- INS_DEF[0x58] = _ins_def_AND;
-
- INS_DEF[0x60] = _ins_def_STARTL;
- INS_DEF[0x61] = _ins_def_CLOOP;
- INS_DEF[0x6E] = _ins_def_BREAK;
- INS_DEF[0x6F] = _ins_def_ENDL;
-
- INS_DEF[0x70] = _ins_def_GOTO;
- INS_DEF[0x71] = _ins_def_JUMPF;
- INS_DEF[0x72] = _ins_def_IFDO;
- INS_DEF[0x73] = _ins_def_ELSE;
- INS_DEF[0x7E] = _ins_def_DONE;
- INS_DEF[0x7F] = _ins_def_CALL;
-
- INS_DEF[0x80] = _ins_def_GETN;
- INS_DEF[0x81] = _ins_def_SETN;
- INS_DEF[0x82] = _ins_def_CALLM;
- INS_DEF[0x83] = _ins_def_INDEXO;
- INS_DEF[0x84] = _ins_def_MODO;
-
- INS_DEF[0xF0] = _ins_def_RETURN;
- INS_DEF[0xF1] = _ins_def_NEW;
- INS_DEF[0xF2] = _ins_def_ENDCLASS;
- INS_DEF[0xFE] = _ins_def_DECLASS;
- INS_DEF[0xFF] = _ins_def_DEFUN;
+ INS_DEC(0x00, _ins_def_NULL, "NULL");
+ INS_DEC(0x01, _ins_def_SYNC, "SYNC");
+
+ INS_DEC(0x02, _ins_def_PRINT, "PRINT");
+ INS_DEC(0x03, _ins_def_DEBUG, "DEBUG");
+ INS_DEC(0x0E, _ins_def_ARGB, "ARGB");
+ INS_DEC(0x0F, _ins_def_LIBC, "LIBC");
+
+ INS_DEC(0x10, _ins_def_POP, "POP");
+ INS_DEC(0x11, _ins_def_ROT, "ROT");
+ INS_DEC(0x12, _ins_def_DUP, "DUP");
+ INS_DEC(0x13, _ins_def_ROT_THREE, "ROT_THREE");
+
+ INS_DEC(0x20, _ins_def_DEC, "DEC");
+ INS_DEC(0x21, _ins_def_LOV, "LOV");
+ INS_DEC(0x22, _ins_def_STV, "STV");
+ INS_DEC(0x23, _ins_def_CTV, "CTV");
+ INS_DEC(0x24, _ins_def_CTS, "CTS");
+
+ INS_DEC(0x30, _ins_def_TYPEOF, "TYPEOF");
+ INS_DEC(0x31, _ins_def_CAST, "CAST");
+
+ INS_DEC(0x40, _ins_def_ADD, "ADD");
+ INS_DEC(0x41, _ins_def_SUB, "SUB");
+ INS_DEC(0x42, _ins_def_MULT, "MULT");
+ INS_DEC(0x43, _ins_def_DIV, "DIV");
+ INS_DEC(0x44, _ins_def_POW, "POW");
+ INS_DEC(0x45, _ins_def_BRT, "BRT");
+ INS_DEC(0x46, _ins_def_SIN, "SIN");
+ INS_DEC(0x47, _ins_def_COS, "COS");
+ INS_DEC(0x48, _ins_def_TAN, "TAN");
+ INS_DEC(0x49, _ins_def_ISIN, "ISIN");
+ INS_DEC(0x4A, _ins_def_ICOS, "ICOS");
+ INS_DEC(0x4B, _ins_def_ITAN, "ITAN");
+ INS_DEC(0x4C, _ins_def_MOD, "MOD");
+ INS_DEC(0x4D, _ins_def_BOR, "BOR");
+ INS_DEC(0x4E, _ins_def_BXOR, "BXOR");
+ INS_DEC(0x4F, _ins_def_BNAND, "BNAND");
+
+ INS_DEC(0x50, _ins_def_GTHAN, "GTHAN");
+ INS_DEC(0x51, _ins_def_LTHAN, "LTHAN");
+ INS_DEC(0x52, _ins_def_GTHAN_EQ, "GTHAN_EQ");
+ INS_DEC(0x53, _ins_def_LTHAN_EQ, "LTHAN_EQ");
+ INS_DEC(0x54, _ins_def_EQ, "EQ");
+ INS_DEC(0x55, _ins_def_NEQ, "NEQ");
+ INS_DEC(0x56, _ins_def_NOT, "NOT");
+ INS_DEC(0x57, _ins_def_OR, "OR");
+ INS_DEC(0x58, _ins_def_AND, "AND");
+
+ INS_DEC(0x60, _ins_def_STARTL, "STARTL");
+ INS_DEC(0x61, _ins_def_CLOOP, "CLOOP");
+ INS_DEC(0x6E, _ins_def_BREAK, "BREAK");
+ INS_DEC(0x6F, _ins_def_ENDL, "ENDL");
+
+ INS_DEC(0x70, _ins_def_GOTO, "GOTO");
+ INS_DEC(0x71, _ins_def_JUMPF, "JUMPF");
+ INS_DEC(0x72, _ins_def_IFDO, "IFDO");
+ INS_DEC(0x73, _ins_def_ELSE, "ELSE");
+ INS_DEC(0x7E, _ins_def_DONE, "DONE");
+ INS_DEC(0x7F, _ins_def_CALL, "CALL");
+
+ INS_DEC(0x80, _ins_def_GETN, "GETN");
+ INS_DEC(0x81, _ins_def_SETN, "SETN");
+ INS_DEC(0x82, _ins_def_CALLM, "CALLM");
+ INS_DEC(0x83, _ins_def_INDEXO, "INDEXO");
+ INS_DEC(0x84, _ins_def_MODO, "MODO");
+
+ INS_DEC(0xF0, _ins_def_RETURN, "RETURN");
+ INS_DEC(0xF1, _ins_def_NEW, "NEW");
+ INS_DEC(0xF2, _ins_def_ENDCLASS, "ENDCLASS");
+ INS_DEC(0xFE, _ins_def_DECLASS, "DECLASS");
+ INS_DEC(0xFF, _ins_def_DEFUN, "DEFUN");
}
int ins_def_is_valid(bc_cont* line)
@@ -102,6 +103,11 @@ int ins_def_is_valid(bc_cont* line)
return rv;
}
+inline void run_ins(rt_t* ctx, bc_cont* line)
+{
+ INS_DEF[line->op](ctx, line);
+}
+
void _ins_def_NULL (rt_t* ctx, bc_cont* line)
{
pc_inc(ctx->pc, 1);
@@ -125,7 +131,7 @@ void _ins_def_DEBUG (rt_t* ctx, bc_cont* line)
}
void _ins_def_ARGB (rt_t* ctx, bc_cont* line)
{
- var_cont* var = stk_at(ctx->stack, 0);
+ var_cont* var = stk_pop(ctx->stack);
stk_push(ctx->argstk, var);
diff --git a/src/vm/src/ns.c b/src/vm/src/ns.c
@@ -90,7 +90,7 @@ ns_t* ns_init(ns_addr size)
inc++;
- ns->root = ns_cont_init(size, 0);
+ ns->root = ns_cont_init(size, (ns->id)<<16);
ns->last = ns->root;
return ns;
@@ -103,7 +103,8 @@ var_cont* ns_cont_del(ns_cont* container, ns_addr to_return)
N_ASSERT(container, "ns_cont_del\n");
N_ASSERT(container->names, "ns_cont_del\n");
- var_cont* rv;
+ var_cont* rv = NULL;
+
for (int i = 0; i < container->size; i++)
{
@@ -116,9 +117,9 @@ var_cont* ns_cont_del(ns_cont* container, ns_addr to_return)
}
else if (i == to_return)
{
- if (container->names[i] != NULL)
+ if (container->names[to_return] != NULL)
{
- rv = container->names[i];
+ rv = container->names[to_return];
if (rv->ownership == container->level)
{
rv->ownership = -1;
diff --git a/src/vm/src/pc.c b/src/vm/src/pc.c
@@ -39,7 +39,7 @@ pc_addr_stk* pc_addr_stk_new(ns_addr address)
pc_addr_stk* new = (pc_addr_stk*)malloc(sizeof(pc_addr_stk));
M_ASSERT(new);
- new->addresses = (pc_addr*)malloc(sizeof(pc_addr)*(PC_RETURN_DEPTH));
+ new->addresses = (pc_addr*)malloc(sizeof(pc_addr)*PC_RETURN_DEPTH);
M_ASSERT(new->addresses);
new->ptr = 0;
diff --git a/src/vm/src/proc.c b/src/vm/src/proc.c
@@ -23,10 +23,33 @@ rt_t* proc_init(char* fname)
return ctx;
}
+void printstk(char* name, stk_t* stk)
+{
+ printf("\t\t%s: %i: ", name, stk->stack->ptr);
+ for (int i = 0; i < stk->stack->ptr; i++)
+ {
+ var_cont* test = stk_at(stk, i);
+
+ printf("%i, ", test->type);
+ }
+ printf("\n");
+}
+
+void proc_printstate(rt_t* ctx)
+{
+ printf("-[ns-%li] [%li]:\t", ctx->vars->id, ctx->pc->address);
+ bc_print_op(ctx->pc->line);
+ printf("\n");
+
+ printstk(" STK", ctx->stack);
+ printstk("ARGSTK", ctx->argstk);
+ printf("------------------------------------------------------------------------------\n");
+}
+
/* Starts execution loop for a runtime context
* rt_t* - Runtime context
*/
-void proc_run(rt_t* ctx)
+inline void proc_run(rt_t* ctx)
{
N_ASSERT(ctx, "proc_run\n");
@@ -36,12 +59,10 @@ void proc_run(rt_t* ctx)
{
if (ctx->db)
{
- printf("-[ns-%i] [%i]:\t", ctx->vars->id, ctx->pc->address);
- bc_print_op(ctx->pc->line);
- printf("\n");
+ proc_printstate(ctx);
}
- INS_DEF[ctx->pc->line->op](ctx, ctx->pc->line);
+ run_ins(ctx, ctx->pc->line);
n++;
}
@@ -49,7 +70,7 @@ void proc_run(rt_t* ctx)
/* Runs exection loop until a return is reached
*/
-void proc_run_to_return(rt_t* ctx)
+inline void proc_run_to_return(rt_t* ctx)
{
N_ASSERT(ctx, "proc_run_to_return\n");
@@ -58,9 +79,7 @@ void proc_run_to_return(rt_t* ctx)
{
if (ctx->db)
{
- printf("*[ns-%i] [%i]:\t", ctx->vars->id, ctx->pc->address);
- bc_print_op(ctx->pc->line);
- printf("\n");
+ proc_printstate(ctx);
}
if (ctx->pc->line->op == 0x7F || ctx->pc->line->op == 0x82)
@@ -68,7 +87,7 @@ void proc_run_to_return(rt_t* ctx)
n++;
}
- INS_DEF[ctx->pc->line->op](ctx, ctx->pc->line);
+ run_ins(ctx, ctx->pc->line);
// Break when the function returns
diff --git a/src/vm/src/var.c b/src/vm/src/var.c
@@ -176,7 +176,6 @@ void var_data_free(void* data, b_type type)
{
var_data_free_PLIST(data);
}
-
if (type != VOID)
free(data);
}
diff --git a/src/vm/tests/cases/bc/expected_output b/src/vm/tests/cases/bc/expected_output
@@ -1,76 +1,76 @@
-fe 0 1,
-20 1, 7, 0 1,
-24 7 0
-22 1, 0 1,
-20 1, 7, 0 2,
-24 7 1
-22 1, 0 2,
-ff 0 3, 7,
-21 1, 0 2,
-21 1, 0 1,
-40
-22 1, 0 1,
-21 1, 0 1,
-22 0, 0 0,
-f0
-f2
-fe 0 2,
-20 1, 7, 0 1,
-24 7 0
-22 1, 0 1,
-20 1, 7, 0 2,
-24 7 1
-22 1, 0 2,
-20 1, 7, 0 3,
-24 7 0
-22 1, 0 3,
-f1 0, 0 0,
-20 0, 6, 0 4,
-22 1, 0 4,
-ff 0 5, 0,
-24 7 0
-21 1, 0 3,
-54
-72
-21 1, 0 2,
-21 1, 0 1,
-40
-22 1, 0 2,
-24 7 1
-22 1, 0 3,
-7e
-21 1, 0 2,
-21 1, 0 1,
-40
-22 1, 0 1,
-24 7 0
-22 1, 0 3,
-f0
-ff 0 6, 0,
-21 1, 0 2,
-2
-21 1, 0 1,
-2
-f0
-ff 0 7, 0, 7
-24 7 0
-21 1, 0 4,
-81 0 1,
-60
-21 0, 0 1,
-21 1, 0 4,
-82 0 3,
-51
-61
-7f 1, 0 5,
-7f 1, 0 6,
-6f
-f0
-f2
-f1 1, 0 2,
-20 1, 6, 0 3,
-22 1, 0 3,
-24 7 f
-e
-21 1, 0 3,
-82 0 7,
+(null) [fe] - N:<0001>, DYN[00]:
+(null) [20] - I:<01>, I:<07>, N:<0001>,
+(null) [24] - DYN[02]: 07 00
+(null) [22] - I:<01>, N:<0001>,
+(null) [20] - I:<01>, I:<07>, N:<0002>,
+(null) [24] - DYN[02]: 07 01
+(null) [22] - I:<01>, N:<0002>,
+(null) [ff] - N:<0003>, I:<07>, DYN[00]:
+(null) [21] - I:<01>, N:<0002>,
+(null) [21] - I:<01>, N:<0001>,
+(null) [40] -
+(null) [22] - I:<01>, N:<0001>,
+(null) [21] - I:<01>, N:<0001>,
+(null) [22] - I:<00>, N:<0000>,
+(null) [f0] -
+(null) [f2] -
+(null) [fe] - N:<0002>, DYN[00]:
+(null) [20] - I:<01>, I:<07>, N:<0001>,
+(null) [24] - DYN[02]: 07 00
+(null) [22] - I:<01>, N:<0001>,
+(null) [20] - I:<01>, I:<07>, N:<0002>,
+(null) [24] - DYN[02]: 07 01
+(null) [22] - I:<01>, N:<0002>,
+(null) [20] - I:<01>, I:<07>, N:<0003>,
+(null) [24] - DYN[02]: 07 00
+(null) [22] - I:<01>, N:<0003>,
+(null) [f1] - I:<00>, N:<0000>,
+(null) [20] - I:<00>, I:<06>, N:<0004>,
+(null) [22] - I:<01>, N:<0004>,
+(null) [ff] - N:<0005>, I:<00>, DYN[00]:
+(null) [24] - DYN[02]: 07 00
+(null) [21] - I:<01>, N:<0003>,
+(null) [54] -
+(null) [72] -
+(null) [21] - I:<01>, N:<0002>,
+(null) [21] - I:<01>, N:<0001>,
+(null) [40] -
+(null) [22] - I:<01>, N:<0002>,
+(null) [24] - DYN[02]: 07 01
+(null) [22] - I:<01>, N:<0003>,
+(null) [7e] -
+(null) [21] - I:<01>, N:<0002>,
+(null) [21] - I:<01>, N:<0001>,
+(null) [40] -
+(null) [22] - I:<01>, N:<0001>,
+(null) [24] - DYN[02]: 07 00
+(null) [22] - I:<01>, N:<0003>,
+(null) [f0] -
+(null) [ff] - N:<0006>, I:<00>, DYN[00]:
+(null) [21] - I:<01>, N:<0002>,
+(null) [2] -
+(null) [21] - I:<01>, N:<0001>,
+(null) [2] -
+(null) [f0] -
+(null) [ff] - N:<0007>, I:<00>, DYN[01]: 07
+(null) [24] - DYN[02]: 07 00
+(null) [21] - I:<01>, N:<0004>,
+(null) [81] - N:<0001>,
+(null) [60] -
+(null) [21] - I:<00>, N:<0001>,
+(null) [21] - I:<01>, N:<0004>,
+(null) [82] - N:<0003>,
+(null) [51] -
+(null) [61] -
+(null) [7f] - I:<01>, N:<0005>,
+(null) [7f] - I:<01>, N:<0006>,
+(null) [6f] -
+(null) [f0] -
+(null) [f2] -
+(null) [f1] - I:<01>, N:<0002>,
+(null) [20] - I:<01>, I:<06>, N:<0003>,
+(null) [22] - I:<01>, N:<0003>,
+(null) [24] - DYN[02]: 07 0f
+(null) [e] -
+(null) [21] - I:<01>, N:<0003>,
+(null) [82] - N:<0007>,
diff --git a/src/vm/tests/cases/ns/Makefile b/src/vm/tests/cases/ns/Makefile
@@ -2,7 +2,7 @@ SRC_DIR = ../../../src
INC_DIR = ../../../inc
CC = gcc
-CFLAGS = -std=c99 -Wall -I$(INC_DIR)
+CFLAGS = -ggdb -std=c99 -Wall -I$(INC_DIR)
DEPS = i$(INC_DIR)/helper.h \
ns.h \
diff --git a/src/vm/tests/cases/ns/test.c b/src/vm/tests/cases/ns/test.c
@@ -10,14 +10,14 @@ int main( void )
var_cont* testing = var_new(G_INT);
var_set(testing, var_data_alloc_G_INT(42), G_INT);
- printf("testing: %i, %i\n", testing->ownership,
+ printf("testing: %li, %i\n", testing->ownership,
var_data_get_G_INT(testing));
ns_dec(test, G_INT, 0, 2);
ns_set(test, 0, 2, testing);
testing_on_namespace = ns_get(test, 0, 2);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
ns_push(test, 5);
@@ -29,14 +29,14 @@ int main( void )
ns_set(test, 0, 1, testing_2);
testing_on_namespace = ns_get(test, 0, 1);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
ns_dec(test, G_INT, 0, 2);
ns_set(test, 0, 2, testing);
testing_on_namespace = ns_get(test, 0, 2);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
ns_push(test, 5);
@@ -45,26 +45,26 @@ int main( void )
ns_set(test, 0, 2, testing);
testing_on_namespace = ns_get(test, 0, 2);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
- printf("Namespace info: %d, %i\n", test->last->size, test->last->level);
+ printf("Namespace info: %d, %li\n", test->last->size, test->last->level);
ns_pop(test);
testing_on_namespace = ns_get(test, 0, 2);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
- printf("Namespace info: %d, %i\n", test->last->size, test->last->level);
+ printf("Namespace info: %d, %li\n", test->last->size, test->last->level);
ns_pop(test);
testing_on_namespace = ns_get(test, 0, 2);
- printf("testing_on_namespace: %i, %i\n", testing_on_namespace->ownership,
+ printf("testing_on_namespace: %li, %i\n", testing_on_namespace->ownership,
var_data_get_G_INT(testing));
- printf("Namespace info: %d, %i\n", test->last->size, test->last->level);
+ printf("Namespace info: %d, %li\n", test->last->size, test->last->level);
ns_del(test);