# HG changeset patch # User Sean Halle # Date 1379254726 25200 # Node ID 10986666560d0ee569307062e8362042d4a6a1f2 # Parent d460a47ed2d6b02df6741933a7ebdbf65244ea06 Changes on copy on D: diff -r d460a47ed2d6 -r 10986666560d PR__PI.h --- a/PR__PI.h Thu Aug 08 02:39:56 2013 -0700 +++ b/PR__PI.h Sun Sep 15 07:18:46 2013 -0700 @@ -46,8 +46,9 @@ #define \ PR_SS__give_lang_data_from_slave PR_int__give_lang_data_from_slave -int32 -PR_PI__give_num_cores(); +#define \ +PR_PI__give_num_cores PR_SS__give_num_cores + //============ //=== Lang Env @@ -130,6 +131,9 @@ void PR_SS__create_the_coreCtlr_OS_threads(); +int +PR_SS__give_num_cores(); + //=================== void * PR_SS__create_lang_env( int32 size, SlaveVP *slave, int32 magicNum ); diff -r d460a47ed2d6 -r 10986666560d PR__int.h --- a/PR__int.h Thu Aug 08 02:39:56 2013 -0700 +++ b/PR__int.h Sun Sep 15 07:18:46 2013 -0700 @@ -197,6 +197,12 @@ PR_int__insert_elem_into_collection( PRCollElem *elem, PRCollElem **coll, int32 hash ); inline +void +PR_int__replace_or_insert_elem_into_collection( PRCollElem *elem, + PRCollElem **coll, + int32 hash ); + +inline void * PR_int__lookup_elem_in_collection( int32 hash, PRCollElem **coll ); @@ -221,6 +227,20 @@ void PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ); +/*Some macro magic -- the __FILE__ turns into a string, and the + * preprocessor merges the quotes. But the __LINE__ turns into an int, + * so have to use the # operator to turn it into a string.. but the + * # operator doesn't expand what comes after, so have to do an extra + * level so that pre-processor first expands __LINE__ into number then + * hands to the # operator, which turns into string (then it merges + * quotes) + */ +#define PR__throw_simple_exception( throwingVP ) \ + do{ PR_int__throw_exception( __FILE__ ", " STR(__LINE__), throwingVP, NULL ); \ + } while(0) + +#define STR( s ) #s + char * PR_int__strDup( char *str ); diff -r d460a47ed2d6 -r 10986666560d langlets/prdsl_wrapper_library.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langlets/prdsl_wrapper_library.h Sun Sep 15 07:18:46 2013 -0700 @@ -0,0 +1,93 @@ +/* + * Copyright 2009 OpenSourceResearchInstitute.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#ifndef _PRDSL_WRAPPER_H +#define _PRDSL_WRAPPER_H + +#include + +//=========================================================================== + //uniquely identifies PRDSL -- should be a jenkins char-hash of "PRDSL" to int32 +#define PRDSL_MAGIC_NUMBER 0000000004 + +typedef struct _PRDSLTaskStub PRDSLTaskStub; + +//=========================================================================== + +/*This is PRDSL's "lang meta task" + *See the proto-runtime wiki entry to learn about "lang meta task" + *In essence, this holds all the meta information that PRDSL needs about a task + */ +struct _PRDSLTaskStub + { + void **args; //given to the birth Fn + int32 numBlockingProp; + PrivQueueStruc *dependentTasksQ; + bool32 isActive; //active after done adding propendents + bool32 canBeAProp; + + PRDSLTaskStub *parentTaskStub; //for liveness, for the wait construct + int32 numLiveChildTasks; + int32 numLiveChildVPs; + bool32 isWaitingForChildTasksToEnd; + bool32 isWaitingForChildThreadsToEnd; + bool32 isEnded; + +// int32 *taskID; //is in PRMetaTask, in prolog + }; + + +//======================= + +void +PRDSL__start( SlaveVP *seedSlv ); + +void +PRDSL__shutdown( SlaveVP *seedSlv ); + +void +PRDSL__wait_for_all_PRDSL_created_work_to_end( SlaveVP *seedSlv ); + +//======================= + +SlaveVP * +PRDSL__create_thread( BirthFnPtr fnPtr, void *initData, + SlaveVP *creatingThd ); + +void +PRDSL__end_thread( SlaveVP *thdToEnd ); + +//======================= + +#define PRDSL__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave) + +#define PRDSL__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave ) + + +//======================= +PRDSLTaskStub * +PRDSL__create_task_ready_to_run( BirthFnPtr birthFn, void *args, SlaveVP *animSlv); + +//inline int32 * +//PRDSL__create_taskID_of_size( int32 numInts, SlaveVP *animSlv ); + + +void +PRDSL__end_task( SlaveVP *animSlv ); + +//========================= +void +PRDSL__taskwait(SlaveVP *animSlv); + + +inline int32 * +PRDSL__give_self_taskID( SlaveVP *animSlv ); + +//=========================================================================== +#endif +