]> git.bts.cx Git - sun.git/blobdiff - runtime/src/sun/compiler/vm_generator.c
Groundwork for arrays
[sun.git] / runtime / src / sun / compiler / vm_generator.c
index deb10b8065a4e625ccaa1865eedb2b27dda738eb..6a3cb19d42bd437a8238e613efd7ade23cd1c379 100644 (file)
@@ -114,7 +114,7 @@ static VMGeneratorOutputScope *generatorCreate() {
        VMGeneratorOutputScope *scope = malloc(sizeof(VMGeneratorOutputScope)); // fixme these mallocs
        memset(scope, 0, sizeof(VMGeneratorOutputScope));
 
        VMGeneratorOutputScope *scope = malloc(sizeof(VMGeneratorOutputScope)); // fixme these mallocs
        memset(scope, 0, sizeof(VMGeneratorOutputScope));
 
-       scope->instructionCount = 1024;
+       scope->instructionCount = 2048;
        scope->instructions = malloc(scope->instructionCount * sizeof(struct VMGeneratorInstruction));
        scope->nextInstructionIdx = 0;
 
        scope->instructions = malloc(scope->instructionCount * sizeof(struct VMGeneratorInstruction));
        scope->nextInstructionIdx = 0;
 
@@ -288,7 +288,7 @@ static bool nodeTypeDefinesScope(SLTNodeType type) {
        switch (type) {
                case SLTNodeTypeModule:
                case SLTNodeTypeFunctionDefinition:
        switch (type) {
                case SLTNodeTypeModule:
                case SLTNodeTypeFunctionDefinition:
-               case SLTNodeTypeTypeDefinition:
+               case SLTNodeTypeUserDefinedTypeDefinition:
                case SLTNodeTypeForIteration:
                case SLTNodeTypeDoIteration:
                case SLTNodeTypeWhileIteration:
                case SLTNodeTypeForIteration:
                case SLTNodeTypeDoIteration:
                case SLTNodeTypeWhileIteration:
@@ -803,7 +803,7 @@ static SVMPointer generateExpressionInstructions(VMGeneratorOutputScope *generat
                        return r;
                }
 
                        return r;
                }
 
-               case SLTNodeTypeTypeAccess:
+               case SLTNodeTypeMemberAccess:
                        generator_assert_msg(false, "not implemented: %s", sltNodeToString(node));
                        return -1;
 
                        generator_assert_msg(false, "not implemented: %s", sltNodeToString(node));
                        return -1;
 
@@ -1001,27 +1001,27 @@ static size_t generateModuleInstructions(VMGeneratorOutputScope *generator, SLTN
                generatorPatchOperand(generator, start, 0, address);
 
                // then do variables
                generatorPatchOperand(generator, start, 0, address);
 
                // then do variables
-               for (SLTNode *n = node->moduleStatementsAndDefinitions; n != NULL; n = n->sequenceNext) {
-                       switch (n->sequenceNode->type) {
-                               case SLTNodeTypeFunctionDefinition:
+               //for (SLTNode *n = node->moduleStatementsAndDefinitions; n != NULL; n = n->sequenceNext) {
+               //      switch (n->sequenceNode->type) {
+               //              case SLTNodeTypeFunctionDefinition:
                                        // Do nothing...
                                        // Do nothing...
-                                       break;
+               //                      break;
 
 
-                               case SLTNodeTypeVariableDefinition:
-                                       generateStatementInstructions(generator, n->sequenceNode, 0);
-                                       break;
+                               //case SLTNodeTypeVariableDefinition:
+                                       //generateStatementInstructions(generator, n->sequenceNode, 0);
+                               //      break;
 
 
-                               default:
+               //              default:
                                        //generator_assert_msg(false, "could not define %s", sltNodeTypeToString(n->sequenceNode->type));
                                        //generator_assert_msg(false, "could not define %s", sltNodeTypeToString(n->sequenceNode->type));
-                                       break;
-                       }
-               }
+               //                      break;
+               //      }
+               //}
 
                // statements
                for (SLTNode *n = node->moduleStatementsAndDefinitions; n != NULL; n = n->sequenceNext) {
                        switch (n->sequenceNode->type) {
 
                // statements
                for (SLTNode *n = node->moduleStatementsAndDefinitions; n != NULL; n = n->sequenceNext) {
                        switch (n->sequenceNode->type) {
-                               case SLTNodeTypeVariableDefinition:
-                               case SLTNodeTypeTypeDefinition:
+                               //case SLTNodeTypeVariableDefinition:
+                               case SLTNodeTypeUserDefinedTypeDefinition:
                                case SLTNodeTypeFunctionDefinition:
                                        // Do nothing...
                                        break;
                                case SLTNodeTypeFunctionDefinition:
                                        // Do nothing...
                                        break;