# HG changeset patch # User Some Random Person # Date 1337878737 25200 # Node ID 33dd14a7f49dadcf95b003f06fc20ddba319b8ae # Parent 79982974d355e490dcaad9ee7a26a11f046697c5 deprecated the default branch -- still have to make MC_shared and Pure_C brchs diff -r 79982974d355 -r 33dd14a7f49d .hgeol --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgeol Thu May 24 09:58:57 2012 -0700 @@ -0,0 +1,14 @@ + +[patterns] +**.py = native +**.txt = native +**.c = native +**.h = native +**.cpp = native +**.java = native +**.class = bin +**.jar = bin +**.sh = native +**.pl = native +**.jpg = bin +**.gif = bin diff -r 79982974d355 -r 33dd14a7f49d ListOfArrays.c --- a/ListOfArrays.c Thu Mar 08 19:05:26 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - -#include "ListOfArrays.h" -#include "../../VMS_Implementations/VMS_impl/vmalloc.h" - -ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block){ - ListOfArrays* newLoA = (ListOfArrays*) VMS__malloc(sizeof(ListOfArrays)); - newLoA->dim1info = makePrivDynArrayOfSize(&(newLoA->dim1),8); - - newLoA->entry_size = entry_size; - newLoA->num_entries_per_fragment = num_entries_per_block; - newLoA->next_free_index = 0; - - return newLoA; -} - -void forAllInListOfArraysDo(ListOfArrays* list, ListOfArraysFnPtr fnPtr){ - int n; - uintptr_t p; - int num_full = list->next_free_index / list->num_entries_per_fragment; //list->dim1info->numInArray -1 - for(n=0;ndim1)[n]; p < (uintptr_t) (list->dim1)[n] + list->num_entries_per_fragment * list->entry_size; p += list->entry_size){ - (*fnPtr)((void*)p); - } - } - int offset_in_last = list->next_free_index % list->num_entries_per_fragment; - n = list->dim1info->numInArray - 1; - if (n >= 0){ - for(p = (uintptr_t)(list->dim1)[n]; p < (uintptr_t)(list->dim1)[n] + offset_in_last * list->entry_size; p += list->entry_size){ - (*fnPtr)((void*)p); - } - } -} - -void freeListOfArrays(ListOfArrays* list){ - freeDynArrayDeep(list->dim1info,&VMS__free); - VMS__free((void*)list); -} - -/* -void addToListOfArraysDependency(Dependency value, ListOfArrays* list){ - int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; - if(offset_in_fragment == 0){ - void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); - addToDynArray(newBlock,list->dim1info); - } - Dependency* typedFragment = (Dependency*) ((list->dim1)[list->dim1info->numInArray -1]); - typedFragment[offset_in_fragment] = value; - list->next_free_index++; -} - -void addToListOfArraysUnit(Unit value, ListOfArrays* list){ - int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; - if(offset_in_fragment == 0){ - void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); - addToDynArray(newBlock,list->dim1info); - } - Unit* typedFragment = (Unit*) ((list->dim1)[list->dim1info->numInArray -1]); - typedFragment[offset_in_fragment] = value; - list->next_free_index++; -} - */ \ No newline at end of file diff -r 79982974d355 -r 33dd14a7f49d ListOfArrays.h --- a/ListOfArrays.h Thu Mar 08 19:05:26 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * File: ListOfArrays.h - * Author: Nina Engelhardt - * - * Created on December 16, 2011, 2:06 PM - */ - -#ifndef LISTOFARRAYS_H -#define LISTOFARRAYS_H - -#include -#include "../DynArray/DynArray.h" - - -typedef struct { - void* next; - void* data; -} ArrayFragment; - -typedef struct { - void** dim1; - PrivDynArrayInfo* dim1info; - //ArrayFragment* last; - size_t entry_size; - int num_entries_per_fragment; - int next_free_index; -} ListOfArrays; - -ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block); - -#define addToListOfArrays(type,value,list) do { \ - int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \ - if(offset_in_fragment == 0){ \ - void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); \ - addToDynArray(newBlock,list->dim1info); \ - } \ - type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \ - typedFragment[offset_in_fragment] = value; \ - list->next_free_index++; \ -} while (0) - -#define addToListOfArrays_ext(type,value,list) do { \ - int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \ - if(offset_in_fragment == 0){ \ - void* newBlock = malloc(list->entry_size * list->num_entries_per_fragment); \ - addToDynArray(newBlock,list->dim1info); \ - } \ - type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \ - typedFragment[offset_in_fragment] = value; \ - list->next_free_index++; \ -} while (0) - -typedef void (*ListOfArraysFnPtr) ( void * ); //fn has to cast void * - -void forAllInListOfArraysDo(ListOfArrays* list, ListOfArraysFnPtr fnPtr); - -#define valueInListOfArrays(type,index,list) ((type*)((list->dim1)[index / list->num_entries_per_fragment]))[index % list->num_entries_per_fragment] - -#define setValueInListOfArrays(type,index,value,list) ((type*)((list->dim1)[index / list->num_entries_per_fragment]))[index % list->num_entries_per_fragment] = value - -void freeListOfArrays(ListOfArrays* list); - -#endif /* LISTOFARRAYS_H */ - diff -r 79982974d355 -r 33dd14a7f49d __brch__DEPRECATED_README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/__brch__DEPRECATED_README Thu May 24 09:58:57 2012 -0700 @@ -0,0 +1,8 @@ + +There are two versions of the library -- one for pure C use, the other for use inside VMS or within applications written in a VMS-based language (IE, inside a top-level function or a call descendant of a top-level function) -- but only when the VMS is the "MC_shared" version. + +The reason is that VMS that uses shared memory on multicores moves the SlaveVPs around among cores. But, the libC and glibC malloc stores info at the top of the stack (a "clever" hack), for a speed improvement. So, when VMS manipulates the stack pointer, and/or moves Slaves to different cores, the "free" seg faults (that was FUN to figure out ; ) So, this version of VMS implements its own malloc. + +It is anticipated that the MC_split version, where each core has separate data, and messages are sent between cores, can handle malloc and free to use the glibC version. + +For now, update to the version of the library you wish to use..