changeset 173:8260b230dc2f

fix RedBlackTree.c
author ikkun
date Thu, 24 Nov 2016 20:51:32 +0900
parents 661b0b0d0399
children f9ed0b8f7132
files src/parallel_execution/rb_tree.c src/parallel_execution/worker.c
diffstat 2 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c	Thu Nov 24 20:22:17 2016 +0900
+++ b/src/parallel_execution/rb_tree.c	Thu Nov 24 20:51:32 2016 +0900
@@ -127,20 +127,19 @@
                     context->data[D_RedBlackTree]->RedBlackTree.newNode);
 }
 
-__code insertCase1(struct Context* context,struct RedBlackTree* traverse, struct RedBlackTree* tree,struct Node *parent, struct Node *grandparent) {
+__code insertCase1(struct Context* context, struct RedBlackTree* traverse, struct Node *parent, struct Node *grandparent) {
     if (parent != NULL) {
         traverse->parent = parent;
         traverse->grandparent = grandparent;
         goto meta(context,C_insertCase2); 
     }
-    tree->root->color = Black;
+    traverse->root->color = Black;
     goto meta(context, C_stackClear);
 }
 
 __code insertCase1_stub(struct Context* context) {
     goto insertCase1(context, 
         &context->data[D_RedBlackTree]->RedBlackTree,
-        &context->data[D_Tree]->Tree,
         &context->data[D_Stack]->stack.data->node,
         &context->data[D_Stack]->stack.data1->node);
 }
@@ -284,7 +283,6 @@
     struct Node* parent = &context->data[D_Stack]->stack.data->node;
     goto rotateLeft1(context,
                     traverse->current,
-                    &context->data[D_Tree]->Tree,
                     traverse,
                     parent,
                     &context->data[D_RotateTree]->rotateTree);
@@ -325,7 +323,6 @@
     struct Node* parent = &context->data[D_Stack]->stack.data->node;
     goto rotateRight1(context,
                      traverse->current,
-                     &context->data[D_Tree]->Tree,
                      traverse,
                      parent,
                      &context->data[D_RotateTree]->rotateTree);
@@ -344,8 +341,8 @@
     
 
 __code getRedBlackTree(struct Context* context, struct RedBlackTree* traverse) {
-    if (tree->root) {
-        traverse->current = tree->root;
+    if (traverse->root) {
+        traverse->current = traverse->root;
 
         goto meta(context, C_search);
     }
@@ -354,7 +351,7 @@
 }
 
 __code getRedBlackTree_stub(struct Context* context) {
-    goto get(context, &context->data[D_Tree]->tree, &context->data[D_RedBlackTree]->RedBlackTree);
+    goto getRedBlackTree(context, &context->data[D_RedBlackTree]->RedBlackTree);
 }
 
 __code search(struct Context* context, struct RedBlackTree* traverse, struct Node* node) {
--- a/src/parallel_execution/worker.c	Thu Nov 24 20:22:17 2016 +0900
+++ b/src/parallel_execution/worker.c	Thu Nov 24 20:51:32 2016 +0900
@@ -4,12 +4,12 @@
 #include "origin_cs.h"
 
 __code getTask1(struct Context* context, struct Queue* queue) {
-    queue->next = C_getTask2
+    queue->next = C_getTask2;
     goto meta(context, queue->take);
 }
 
 __code getTask1_stub(struct Context* context) {
-    goto getTask1(context, &context->data[D_ActiveQueue]->queue);
+    goto getTask1(context, &context->data[D_ActiveQueue]->Queue);
 }
 
 __code getTask2(struct Context* context, struct Task* task, struct Node* node) {
@@ -17,12 +17,12 @@
 
     struct Traverse *t = &context->data[D_Traverse]->Traverse;
     t->next = task->code;
-    context->next = C_getTask1
+    context->next = C_getTask1;
     goto meta(context, C_get);
 }
 
 __code getTask2_stub(struct Context* context) {
-    goto getTask2(context, &(context->data[D_ActiveQueue]->queue.data->task), &context->data[D_Node]->node);
+    goto getTask2(context, &(context->data[D_ActiveQueue]->Queue.data->Task), &context->data[D_Node]->node);
 }
 
 #ifdef USE_CUDA