changeset 4:10986666560d Dev_Univ

Changes on copy on D:
author Sean Halle <seanhalle@yahoo.com>
date Sun, 15 Sep 2013 07:18:46 -0700
parents d460a47ed2d6
children c390d605702c
files PR__PI.h PR__int.h langlets/prdsl_wrapper_library.h
diffstat 3 files changed, 119 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/PR__PI.h	Thu Aug 08 02:39:56 2013 -0700
     1.2 +++ b/PR__PI.h	Sun Sep 15 07:18:46 2013 -0700
     1.3 @@ -46,8 +46,9 @@
     1.4  #define \
     1.5  PR_SS__give_lang_data_from_slave   PR_int__give_lang_data_from_slave
     1.6  
     1.7 -int32
     1.8 -PR_PI__give_num_cores();
     1.9 +#define \
    1.10 +PR_PI__give_num_cores  PR_SS__give_num_cores
    1.11 +
    1.12  
    1.13  //============
    1.14  //=== Lang Env
    1.15 @@ -130,6 +131,9 @@
    1.16  void
    1.17  PR_SS__create_the_coreCtlr_OS_threads();
    1.18  
    1.19 +int
    1.20 +PR_SS__give_num_cores();
    1.21 +
    1.22  //===================
    1.23  void *
    1.24  PR_SS__create_lang_env( int32 size, SlaveVP *slave, int32 magicNum );
     2.1 --- a/PR__int.h	Thu Aug 08 02:39:56 2013 -0700
     2.2 +++ b/PR__int.h	Sun Sep 15 07:18:46 2013 -0700
     2.3 @@ -197,6 +197,12 @@
     2.4  PR_int__insert_elem_into_collection( PRCollElem *elem, PRCollElem **coll, int32 hash );
     2.5  
     2.6  inline
     2.7 +void
     2.8 +PR_int__replace_or_insert_elem_into_collection( PRCollElem *elem, 
     2.9 +                                                PRCollElem **coll, 
    2.10 +                                                int32 hash );
    2.11 +
    2.12 +inline
    2.13  void *
    2.14  PR_int__lookup_elem_in_collection( int32 hash, PRCollElem **coll );
    2.15  
    2.16 @@ -221,6 +227,20 @@
    2.17  void
    2.18  PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData );
    2.19  
    2.20 +/*Some macro magic -- the __FILE__ turns into a string, and the 
    2.21 + * preprocessor merges the quotes.  But the __LINE__ turns into an int,
    2.22 + * so have to use the # operator to turn it into a string..  but the
    2.23 + * # operator doesn't expand what comes after, so have to do an extra
    2.24 + * level so that pre-processor first expands __LINE__ into number then 
    2.25 + * hands to the # operator, which turns into string (then it merges
    2.26 + * quotes)
    2.27 + */
    2.28 +#define PR__throw_simple_exception( throwingVP ) \
    2.29 +   do{ PR_int__throw_exception( __FILE__ ", " STR(__LINE__), throwingVP, NULL ); \
    2.30 +     } while(0)
    2.31 +
    2.32 +#define STR( s ) #s
    2.33 +
    2.34  char *
    2.35  PR_int__strDup( char *str );
    2.36  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/langlets/prdsl_wrapper_library.h	Sun Sep 15 07:18:46 2013 -0700
     3.3 @@ -0,0 +1,93 @@
     3.4 +/*
     3.5 + *  Copyright 2009 OpenSourceResearchInstitute.org
     3.6 + *  Licensed under GNU General Public License version 2
     3.7 + *
     3.8 + * Author: seanhalle@yahoo.com
     3.9 + *
    3.10 + */
    3.11 +
    3.12 +#ifndef _PRDSL_WRAPPER_H
    3.13 +#define	_PRDSL_WRAPPER_H
    3.14 +
    3.15 +#include <PR__include/PR__structs__common.h>
    3.16 +
    3.17 +//===========================================================================
    3.18 +   //uniquely identifies PRDSL -- should be a jenkins char-hash of "PRDSL" to int32
    3.19 +#define PRDSL_MAGIC_NUMBER 0000000004
    3.20 +
    3.21 +typedef struct _PRDSLTaskStub  PRDSLTaskStub;
    3.22 +
    3.23 +//===========================================================================
    3.24 +
    3.25 +/*This is PRDSL's "lang meta task"
    3.26 + *See the proto-runtime wiki entry to learn about "lang meta task"
    3.27 + *In essence, this holds all the meta information that PRDSL needs about a task
    3.28 + */
    3.29 +struct _PRDSLTaskStub
    3.30 + {
    3.31 +   void           **args;            //given to the birth Fn
    3.32 +   int32            numBlockingProp;
    3.33 +   PrivQueueStruc  *dependentTasksQ;
    3.34 +   bool32           isActive; //active after done adding propendents
    3.35 +   bool32           canBeAProp;
    3.36 +   
    3.37 +   PRDSLTaskStub *parentTaskStub; //for liveness, for the wait construct
    3.38 +   int32          numLiveChildTasks;
    3.39 +   int32          numLiveChildVPs;
    3.40 +   bool32         isWaitingForChildTasksToEnd;
    3.41 +   bool32         isWaitingForChildThreadsToEnd;
    3.42 +   bool32         isEnded;
    3.43 +   
    3.44 +//   int32         *taskID; //is in PRMetaTask, in prolog
    3.45 + };
    3.46 +
    3.47 +
    3.48 +//=======================
    3.49 +
    3.50 +void
    3.51 +PRDSL__start( SlaveVP *seedSlv );
    3.52 +
    3.53 +void
    3.54 +PRDSL__shutdown( SlaveVP *seedSlv );
    3.55 +
    3.56 +void
    3.57 +PRDSL__wait_for_all_PRDSL_created_work_to_end( SlaveVP *seedSlv );
    3.58 +
    3.59 +//=======================
    3.60 +
    3.61 +SlaveVP *
    3.62 +PRDSL__create_thread( BirthFnPtr fnPtr,   void *initData,
    3.63 +                                               SlaveVP *creatingThd );
    3.64 +
    3.65 +void
    3.66 +PRDSL__end_thread( SlaveVP *thdToEnd );
    3.67 +
    3.68 +//=======================
    3.69 +
    3.70 +#define PRDSL__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave)
    3.71 +
    3.72 +#define PRDSL__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave )
    3.73 +
    3.74 +
    3.75 +//=======================
    3.76 +PRDSLTaskStub *
    3.77 +PRDSL__create_task_ready_to_run( BirthFnPtr birthFn, void *args, SlaveVP *animSlv);
    3.78 +
    3.79 +//inline int32 *
    3.80 +//PRDSL__create_taskID_of_size( int32 numInts, SlaveVP *animSlv );
    3.81 +
    3.82 +
    3.83 +void
    3.84 +PRDSL__end_task( SlaveVP *animSlv );
    3.85 +
    3.86 +//=========================
    3.87 +void
    3.88 +PRDSL__taskwait(SlaveVP *animSlv);
    3.89 +
    3.90 +
    3.91 +inline int32 *
    3.92 +PRDSL__give_self_taskID( SlaveVP *animSlv );
    3.93 +
    3.94 +//===========================================================================
    3.95 +#endif	
    3.96 +