My Project
Loading...
Searching...
No Matches
Namespaces | Data Structures | Typedefs | Enumerations | Functions
vspace Namespace Reference

Namespaces

namespace  internals
 

Data Structures

class  DequeueEvent
 
struct  DictSpec
 
class  EnqueueEvent
 
class  Event
 
class  EventSet
 
class  Queue
 
struct  Result
 
class  Semaphore
 
struct  Status
 
class  SyncReadEvent
 
class  SyncVar
 
class  VMap
 
struct  VRef
 
struct  VRef< void >
 
class  VString
 
class  WaitSemaphoreEvent
 
struct  ZRef
 

Typedefs

typedef VMap< DictSpecVDict
 
typedef internals::Mutex FastLock
 
typedef internals::Mutex Mutex
 

Enumerations

enum  ErrCode {
  ErrNone , ErrGeneral , ErrFile , ErrMMap ,
  ErrOS
}
 

Functions

pid_t fork_process ()
 
static Status vmem_init ()
 
static void vmem_deinit ()
 
template<typename T >
VRef< Tvnull ()
 
template<typename T >
VRef< Tvnew ()
 
template<typename T >
VRef< Tvnew_uninitialized ()
 
template<typename T >
VRef< Tvnew_array (size_t n)
 
template<typename T >
VRef< Tvnew_uninitialized_array (size_t n)
 
template<typename T , typename Arg >
VRef< Tvnew (Arg arg)
 
template<typename T , typename Arg1 , typename Arg2 >
VRef< Tvnew (Arg1 arg1, Arg2 arg2)
 
template<typename T , typename Arg1 , typename Arg2 , typename Arg3 >
VRef< Tvnew (Arg1 arg1, Arg2 arg2, Arg3 arg3)
 
template<typename T , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 >
VRef< Tvnew (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
 
template<typename T , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 >
VRef< Tvnew (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
 
template<typename T >
ZRef< Tznull ()
 
template<typename T >
ZRef< Tznew ()
 
template<typename T >
ZRef< Tznew_uninitialized ()
 
template<typename T >
ZRef< Tznew_array (size_t n)
 
template<typename T >
ZRef< Tznew_uninitialized_array (size_t n)
 
template<typename T , typename Arg >
ZRef< Tznew (Arg arg)
 
template<typename T , typename Arg1 , typename Arg2 >
ZRef< Tznew (Arg1 arg1, Arg2 arg2)
 
template<typename T , typename Arg1 , typename Arg2 , typename Arg3 >
ZRef< Tznew (Arg1 arg1, Arg2 arg2, Arg3 arg3)
 
static VRef< VStringvstring (const char *s)
 
static VRef< VStringvstring (const char *s, size_t len)
 
static VRef< VStringvstring (size_t len)
 

Typedef Documentation

◆ FastLock

Definition at line 2340 of file vspace.h.

◆ Mutex

Definition at line 2343 of file vspace.h.

◆ VDict

Definition at line 2333 of file vspace.h.

Enumeration Type Documentation

◆ ErrCode

Enumerator
ErrNone 
ErrGeneral 
ErrFile 
ErrMMap 
ErrOS 

Definition at line 1375 of file vspace.h.

1375 {
1376 ErrNone,
1377 ErrGeneral,
1378 ErrFile,
1379 ErrMMap,
1380 ErrOS,
1381};
@ ErrGeneral
Definition: vspace.h:1377
@ ErrOS
Definition: vspace.h:1380
@ ErrNone
Definition: vspace.h:1376
@ ErrFile
Definition: vspace.h:1378
@ ErrMMap
Definition: vspace.h:1379

Function Documentation

◆ fork_process()

pid_t vspace::fork_process ( )

Definition at line 993 of file vspace.cc.

993 {
994 using namespace internals;
995 lock_metapage();
996 for (int p = 0; p < MAX_PROCESS; p++) {
997 if (vmem.metapage->process_info[p].pid == 0) {
998 pid_t pid = fork();
999 if (pid < 0) {
1000 // error
1001 return -1;
1002 } else if (pid == 0) {
1003 // child process
1004 int parent = vmem.current_process;
1005 vmem.current_process = p;
1006 lock_metapage();
1007 vmem.metapage->process_info[p].pid = getpid();
1008 unlock_metapage();
1009 send_signal(parent);
1010 } else {
1011 // parent process
1013 wait_signal();
1014 // child has unlocked metapage, so we don't need to.
1015 }
1016 return pid;
1017 }
1018 }
1020 return -1;
1021}
int p
Definition: cfModGcd.cc:4078
void unlock_metapage()
Definition: vspace.cc:883
ipc_signal_t wait_signal(bool lock)
Definition: vspace.cc:987

◆ vmem_deinit()

static void vspace::vmem_deinit ( )
inlinestatic

Definition at line 1742 of file vspace.h.

1742 {
1743 internals::vmem.deinit();
1744}

◆ vmem_init()

static Status vspace::vmem_init ( )
inlinestatic

Definition at line 1738 of file vspace.h.

1738 {
1739 return internals::vmem.init();
1740}

◆ vnew() [1/6]

template<typename T >
VRef< T > vspace::vnew ( )

Definition at line 1872 of file vspace.h.

1872 {
1874 new (result.to_ptr()) T();
1875 return result;
1876}
return result
Definition: facAbsBiFact.cc:75
STATIC_VAR jList * T
Definition: janet.cc:30

◆ vnew() [2/6]

template<typename T , typename Arg >
VRef< T > vspace::vnew ( Arg  arg)

Definition at line 1901 of file vspace.h.

1901 {
1903 new (result.to_ptr()) T(arg);
1904 return result;
1905}

◆ vnew() [3/6]

template<typename T , typename Arg1 , typename Arg2 >
VRef< T > vspace::vnew ( Arg1  arg1,
Arg2  arg2 
)

Definition at line 1908 of file vspace.h.

1908 {
1910 new (result.to_ptr()) T(arg1, arg2);
1911 return result;
1912}

◆ vnew() [4/6]

template<typename T , typename Arg1 , typename Arg2 , typename Arg3 >
VRef< T > vspace::vnew ( Arg1  arg1,
Arg2  arg2,
Arg3  arg3 
)

Definition at line 1915 of file vspace.h.

1915 {
1917 new (result.to_ptr()) T(arg1, arg2, arg3);
1918 return result;
1919}

◆ vnew() [5/6]

template<typename T , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 >
VRef< T > vspace::vnew ( Arg1  arg1,
Arg2  arg2,
Arg3  arg3,
Arg4  arg4 
)

Definition at line 1923 of file vspace.h.

1923 {
1925 new (result.to_ptr()) T(arg1, arg2, arg3, arg4);
1926 return result;
1927}

◆ vnew() [6/6]

template<typename T , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 >
VRef< T > vspace::vnew ( Arg1  arg1,
Arg2  arg2,
Arg3  arg3,
Arg4  arg4,
Arg5  arg5 
)

Definition at line 1931 of file vspace.h.

1931 {
1933 new (result.to_ptr()) T(arg1, arg2, arg3, arg4, arg5);
1934 return result;
1935}

◆ vnew_array()

template<typename T >
VRef< T > vspace::vnew_array ( size_t  n)

Definition at line 1885 of file vspace.h.

1885 {
1887 T *ptr = result.as_ptr();
1888 for (size_t i = 0; i < n; i++) {
1889 new (ptr + i) T();
1890 }
1891 return result;
1892}
int i
Definition: cfEzgcd.cc:132

◆ vnew_uninitialized()

template<typename T >
VRef< T > vspace::vnew_uninitialized ( )

Definition at line 1879 of file vspace.h.

1879 {
1881 return result;
1882}

◆ vnew_uninitialized_array()

template<typename T >
VRef< T > vspace::vnew_uninitialized_array ( size_t  n)

Definition at line 1895 of file vspace.h.

1895 {
1897 return result;
1898}

◆ vnull()

template<typename T >
VRef< T > vspace::vnull ( )

Definition at line 1867 of file vspace.h.

1867 {
1868 return VRef<T>::from_vaddr(internals::VADDR_NULL);
1869}

◆ vstring() [1/3]

static VRef< VString > vspace::vstring ( const char *  s)
inlinestatic

Definition at line 2101 of file vspace.h.

2101 {
2102 return vnew<VString>(s);
2103}
const CanonicalForm int s
Definition: facAbsFact.cc:51

◆ vstring() [2/3]

static VRef< VString > vspace::vstring ( const char *  s,
size_t  len 
)
inlinestatic

Definition at line 2105 of file vspace.h.

2105 {
2106 return vnew<VString>(s, len);
2107}

◆ vstring() [3/3]

static VRef< VString > vspace::vstring ( size_t  len)
inlinestatic

Definition at line 2109 of file vspace.h.

2109 {
2110 return vnew<VString>(len);
2111}

◆ znew() [1/4]

template<typename T >
ZRef< T > vspace::znew ( )

Definition at line 2015 of file vspace.h.

2015 {
2017 new (result.to_ptr()) T();
2018 return result;
2019}

◆ znew() [2/4]

template<typename T , typename Arg >
ZRef< T > vspace::znew ( Arg  arg)

Definition at line 2044 of file vspace.h.

2044 {
2046 new (result.to_ptr()) T(arg);
2047 return result;
2048}

◆ znew() [3/4]

template<typename T , typename Arg1 , typename Arg2 >
ZRef< T > vspace::znew ( Arg1  arg1,
Arg2  arg2 
)

Definition at line 2051 of file vspace.h.

2051 {
2053 new (result.to_ptr()) T(arg1, arg2);
2054 return result;
2055}

◆ znew() [4/4]

template<typename T , typename Arg1 , typename Arg2 , typename Arg3 >
ZRef< T > vspace::znew ( Arg1  arg1,
Arg2  arg2,
Arg3  arg3 
)

Definition at line 2058 of file vspace.h.

2058 {
2060 new (result.to_ptr()) T(arg1, arg2, arg3);
2061 return result;
2062}

◆ znew_array()

template<typename T >
ZRef< T > vspace::znew_array ( size_t  n)

Definition at line 2028 of file vspace.h.

2028 {
2030 T *ptr = result.as_ptr();
2031 for (size_t i = 0; i < n; i++) {
2032 new (ptr + i) T();
2033 }
2034 return result;
2035}

◆ znew_uninitialized()

template<typename T >
ZRef< T > vspace::znew_uninitialized ( )

Definition at line 2022 of file vspace.h.

2022 {
2024 return result;
2025}

◆ znew_uninitialized_array()

template<typename T >
ZRef< T > vspace::znew_uninitialized_array ( size_t  n)

Definition at line 2038 of file vspace.h.

2038 {
2040 return result;
2041}

◆ znull()

template<typename T >
ZRef< T > vspace::znull ( )

Definition at line 2010 of file vspace.h.

2010 {
2011 return ZRef<T>(internals::VADDR_NULL);
2012}