Loading...
Searching...
No Matches
vspace Namespace Reference

## Namespaces

namespace | internals

## Data Structures

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

## Typedefs

typedef VMap< DictSpec > | VDict
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< T > | vnull ()
template<typename T>
VRef< T > | vnew ()
template<typename T>
VRef< T > | vnew_uninitialized ()
template<typename T>
VRef< T > | vnew_array (size_t n)
template<typename T>
VRef< T > | vnew_uninitialized_array (size_t n)
template<typename T, typename Arg>
VRef< T > | vnew (Arg arg)
template<typename T, typename Arg1, typename Arg2>
VRef< T > | vnew (Arg1 arg1, Arg2 arg2)
template<typename T, typename Arg1, typename Arg2, typename Arg3>
VRef< T > | vnew (Arg1 arg1, Arg2 arg2, Arg3 arg3)
template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
VRef< T > | vnew (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
VRef< T > | vnew (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
template<typename T>
ZRef< T > | znull ()
template<typename T>
ZRef< T > | znew ()
template<typename T>
ZRef< T > | znew_uninitialized ()
template<typename T>
ZRef< T > | znew_array (size_t n)
template<typename T>
ZRef< T > | znew_uninitialized_array (size_t n)
template<typename T, typename Arg>
ZRef< T > | znew (Arg arg)
template<typename T, typename Arg1, typename Arg2>
ZRef< T > | znew (Arg1 arg1, Arg2 arg2)
template<typename T, typename Arg1, typename Arg2, typename Arg3>
ZRef< T > | znew (Arg1 arg1, Arg2 arg2, Arg3 arg3)
static VRef< VString > | vstring (const char *s)
static VRef< VString > | vstring (const char *s, size_t len)
static VRef< VString > | vstring (size_t len)

## Typedef Documentation

## FastLock

typedef internals::Mutex vspace::FastLock

Definition at line 2340 of file vspace.h.

## Mutex

typedef internals::Mutex vspace::Mutex

Definition at line 2343 of file vspace.h.

## VDict

typedef VMap<DictSpec> vspace::VDict

Definition at line 2333 of file vspace.h.

## Enumeration Type Documentation

## ErrCode

enum vspace::ErrCode

Enumerator
ErrNone |
ErrGeneral |
ErrFile |
ErrMMap |
ErrOS |

Definition at line 1375 of file vspace.h.

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

## Function Documentation

## fork_process()

pid_t vspace::fork_process | ( |  | ) |

Definition at line 1081 of file vspace.cc.

{
using namespace internals;
lock_metapage();
for (int p = 0; p < MAX_PROCESS; p++) {
if (vmem.metapage->process_info[p].pid == 0) {
pid_t pid = fork();
if (pid < 0) {
// error
return -1;
} else if (pid == 0) {
// child process
int parent = vmem.current_process;
vmem.current_process = p;
lock_metapage();
vmem.metapage->process_info[p].pid = getpid();
unlock_metapage();
send_signal(parent);
} else {
// parent process
unlock_metapage();
wait_signal();
// child has unlocked metapage, so we don't need to.
}
return pid;
}
}
unlock_metapage();
return -1;
}
p
int p
Definition cfModGcd.cc:4086
vspace::internals
Definition vspace.cc:616
vspace::internals::unlock_metapage
void unlock_metapage()
Definition vspace.cc:929
vspace::internals::wait_signal
ipc_signal_t wait_signal(bool lock)
Definition vspace.cc:1075

## vmem_deinit()

void vspace::vmem_deinit | ( |  | ) |

inline static

Definition at line 1742 of file vspace.h.

{
internals::vmem.deinit();
}
vspace::internals::vmem
static VMem & vmem
Definition vspace.h:1635

## vmem_init()

Status vspace::vmem_init | ( |  | ) |

inline static

Definition at line 1738 of file vspace.h.

{
return internals::vmem.init();
}

## vnew() [1/6]

template<typename T>

VRef< T > vspace::vnew | ( |  | ) |

Definition at line 1872 of file vspace.h.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T();
return result;
}
result
return result
Definition facAbsBiFact.cc:76
T
STATIC_VAR jList * T
Definition janet.cc:30
vspace::VRef
Definition vspace.h:1747
vspace::VRef::alloc
static VRef< T > alloc(size_t n=1)
Definition vspace.h:1802

## vnew() [2/6]

template<typename T, typename Arg>

VRef< T > vspace::vnew | ( | Arg | arg | ) |

Definition at line 1901 of file vspace.h.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T(arg);
return result;
}

## 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.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2);
return result;
}

## 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.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2, arg3);
return result;
}

## 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.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2, arg3, arg4);
return result;
}

## 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.

{
VRef<T> result = VRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2, arg3, arg4, arg5);
return result;
}

## vnew_array()

template<typename T>

VRef< T > vspace::vnew_array | ( | size_t | n | ) |

Definition at line 1885 of file vspace.h.

{
VRef<T> result = VRef<T>::alloc(n);
T *ptr = result.as_ptr();
for (size_t i = 0; i < n; i++) {
new (ptr + i) T();
}
return result;
}
i
int i
Definition cfEzgcd.cc:132

## vnew_uninitialized()

template<typename T>

VRef< T > vspace::vnew_uninitialized | ( |  | ) |

Definition at line 1879 of file vspace.h.

{
VRef<T> result = VRef<T>::alloc();
return result;
}

## vnew_uninitialized_array()

template<typename T>

VRef< T > vspace::vnew_uninitialized_array | ( | size_t | n | ) |

Definition at line 1895 of file vspace.h.

{
VRef<T> result = VRef<T>::alloc(n);
return result;
}

## vnull()

template<typename T>

VRef< T > vspace::vnull | ( |  | ) |

Definition at line 1867 of file vspace.h.

{
return VRef<T>::from_vaddr(internals::VADDR_NULL);
}
vspace::internals::VADDR_NULL
const vaddr_t VADDR_NULL
Definition vspace.h:1417
vspace::VRef::from_vaddr
static VRef< T > from_vaddr(internals::vaddr_t vaddr)
Definition vspace.h:1755

## vstring() [1/3]

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

inline static

Definition at line 2101 of file vspace.h.

{
return vnew<VString>(s);
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51
vspace::vnew
VRef< T > vnew()
Definition vspace.h:1872

## vstring() [2/3]

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

inline static

Definition at line 2105 of file vspace.h.

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

## vstring() [3/3]

VRef< VString > vspace::vstring | ( | size_t | len | ) |

inline static

Definition at line 2109 of file vspace.h.

{
return vnew<VString>(len);
}

## znew() [1/4]

template<typename T>

ZRef< T > vspace::znew | ( |  | ) |

Definition at line 2015 of file vspace.h.

{
ZRef<T> result = ZRef<T>::alloc();
new (result.to_ptr()) T();
return result;
}
vspace::ZRef
Definition vspace.h:1938
vspace::ZRef::alloc
static internals::vaddr_t alloc()
Definition vspace.h:2004

## znew() [2/4]

template<typename T, typename Arg>

ZRef< T > vspace::znew | ( | Arg | arg | ) |

Definition at line 2044 of file vspace.h.

{
ZRef<T> result = ZRef<T>::alloc();
new (result.to_ptr()) T(arg);
return result;
}

## 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.

{
ZRef<T> result = ZRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2);
return result;
}

## 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.

{
ZRef<T> result = ZRef<T>::alloc();
new (result.to_ptr()) T(arg1, arg2, arg3);
return result;
}

## znew_array()

template<typename T>

ZRef< T > vspace::znew_array | ( | size_t | n | ) |

Definition at line 2028 of file vspace.h.

{
ZRef<T> result = ZRef<T>::alloc();
T *ptr = result.as_ptr();
for (size_t i = 0; i < n; i++) {
new (ptr + i) T();
}
return result;
}

## znew_uninitialized()

template<typename T>

ZRef< T > vspace::znew_uninitialized | ( |  | ) |

Definition at line 2022 of file vspace.h.

{
ZRef<T> result = ZRef<T>::alloc();
return result;
}

## znew_uninitialized_array()

template<typename T>

ZRef< T > vspace::znew_uninitialized_array | ( | size_t | n | ) |

Definition at line 2038 of file vspace.h.

{
ZRef<T> result = ZRef<T>::alloc();
return result;
}

## znull()

template<typename T>

ZRef< T > vspace::znull | ( |  | ) |

Definition at line 2010 of file vspace.h.

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