changeset 135:77a7ccb0d84d

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Nov 2016 14:29:31 +0900
parents 2eccf4564efe
children a747dc9d4da6
files src/parallel_execution/context.h src/parallel_execution/stack.c
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Tue Nov 08 10:44:39 2016 +0900
+++ b/src/parallel_execution/context.h	Tue Nov 08 14:29:31 2016 +0900
@@ -97,6 +97,10 @@
     GetQueue,
     PushSingleLinkedStack,
     PopSingleLinkedStack,
+    Pop2SingleLinkedStack,
+    GetSingleLinkedStack,
+    Get2SingleLinkedStack,
+    IsEmptySingleLinkedStack,
     SpawnTask,
     Twice,
     StartTime,
@@ -206,7 +210,7 @@
     // Stack implementations
     struct SingleLinkedStack {
         struct Element* top;
-    } singleLinekedStack;
+    } singleLinkedStack;
     struct ArrayStack {
         int size;
         int limit;
--- a/src/parallel_execution/stack.c	Tue Nov 08 10:44:39 2016 +0900
+++ b/src/parallel_execution/stack.c	Tue Nov 08 14:29:31 2016 +0900
@@ -1,11 +1,11 @@
+#include "context.h"
 #include "stack.h"
-#include "context.h"
 #include "origin_cs.h"
 
 union Data* createSingleLinkedStack(struct Context* context) {
-    struct Stack* stack = ALLOCATE(context, Stack);
-    struct SingleLinkedStack* singleLinkedStack = ALLOCATE(context, SignleLinkedStack);
-    stack->stack = singleLinkedStack;
+    struct Stack* stack = &ALLOCATE(context, Stack)->stack;
+    struct SingleLinkedStack* singleLinkedStack = &ALLOCATE(context, SingleLinkedStack)->singleLinkedStack;
+    stack->stack = (union Data*)singleLinkedStack;
     singleLinkedStack->top = NULL;
     stack->push = PushSingleLinkedStack;
     stack->pop  = PopSingleLinkedStack;
@@ -13,7 +13,7 @@
     stack->get  = GetSingleLinkedStack;
     stack->get2  = Get2SingleLinkedStack;
     stack->isEmpty = IsEmptySingleLinkedStack;
-    return GET_DATA(stack);
+    return (union Data*)(stack);
 }
 
 __code pushSingleLinkedStack(struct Context* context, struct SingleLinkedStack* stack, struct Element* element, union Data* data, enum Code next) {
@@ -24,12 +24,12 @@
 }
 
 __code pushSingleLinkedStack_stub(struct Context* context) {
-    struct Element* element = ALLOCATE(context, Element);
+    struct Element* element = &ALLOCATE(context, Element)->element;
     goto pushSingleLinkedStack(context,
-                               (struct SignleLinkedStack *)context->data[Stack]->stack.stack,
+                               (struct SignleLinkedStack *)&context->data[Stack]->stack.stack,
                                element,
-                               context->data[Stack]->stack.data,
-                               context->data[Stack]->stack.next);
+                               &context->data[Stack]->stack.data,
+                               &context->data[Stack]->stack.next);
 }
 
 __code popSingleLinkedStack(struct Context* context, struct SingleLinkedStack* stack, union Data** data, enum Code next) {