Skip to content

Commit

Permalink
Fixed all out of order initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
meister committed Nov 4, 2023
1 parent 0968c0b commit 23ab1c5
Show file tree
Hide file tree
Showing 19 changed files with 114 additions and 64 deletions.
2 changes: 1 addition & 1 deletion include/clasp/clbind/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class WRAPPER_VariadicFunction<RT (*)(ARGS...), Policies, clbind::pureOutsPack<P
enum { NumParams = sizeof...(ARGS) };

WRAPPER_VariadicFunction(FuncType ptr, core::FunctionDescription_sp fdesc, core::T_sp code)
: fptr(ptr), GlobalSimpleFunBase_O(fdesc, core::ClaspXepFunction::make<MyType>(), code) {
: GlobalSimpleFunBase_O(fdesc, core::ClaspXepFunction::make<MyType>(), code), fptr(ptr) {
this->validateCodePointer((void **)&this->fptr, sizeof(this->fptr));
};

Expand Down
17 changes: 12 additions & 5 deletions include/clasp/core/backtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ DebuggerFrame_O : public General_O {
DebuggerFrame_O(T_sp a_fname, T_sp a_return_address, T_sp a_sp, T_sp a_fd,
T_sp a_closure, T_sp a_args, bool a_av, List_sp a_locals,
T_sp a_lang, bool a_is_xep)
: fname(a_fname), return_address(a_return_address),
source_position(a_sp), function_description(a_fd),
closure(a_closure), args(a_args), args_available(a_av),
locals(a_locals), is_xep(a_is_xep),
lang(a_lang), up(nil<T_O>()), down(nil<T_O>())
: fname(a_fname),
return_address(a_return_address),
source_position(a_sp),
function_description(a_fd),
closure(a_closure),
args(a_args),
args_available(a_av),
locals(a_locals),
lang(a_lang),
up(nil<T_O>()),
down(nil<T_O>()),
is_xep(a_is_xep)
{}
static DebuggerFrame_sp make(T_sp fname, T_sp ra,
T_sp sp, T_sp fd,
Expand Down
5 changes: 4 additions & 1 deletion include/clasp/core/funcallableInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ class FuncallableInstance_O : public Function_O {
explicit FuncallableInstance_O(GlobalSimpleFun_sp fdesc, Instance_sp metaClass, size_t slots)
: Base(fdesc), _Class(metaClass), _RealFunction(nil<Function_O>()){};
FuncallableInstance_O(GlobalSimpleFun_sp fdesc, Instance_sp cl, Rack_sp rack)
: Base(fdesc), _Class(cl), _Rack(rack), _RealFunction(nil<Function_O>()){};
: Base(fdesc),
_Rack(rack),
_Class(cl),
_RealFunction(nil<Function_O>()){};
virtual ~FuncallableInstance_O(){};

public:
Expand Down
17 changes: 9 additions & 8 deletions include/clasp/core/lisp.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ struct globals_t {
mutable mp::SharedMutex _FinalizersMutex;
mutable mp::SharedMutex _SourceFilesMutex; // Protect _SourceFileIndices
mutable mp::SharedMutex _PackagesMutex; // Protect _PackageNameIndexMap
mutable mp::SharedMutex _ThePathnameTranslationsMutex; // Protect _ThePathnameTranslations
mutable mp::SharedMutex _JITLogMutex; // Protect _jit logging
mutable mp::SharedMutex _UnixSignalHandlersMutex; // Protect _UnixSignalHandlers
mutable mp::SharedMutex _CodeBlocksMutex;
#ifdef DEBUG_MONITOR_SUPPORT
mutable mp::SharedMutex _MonitorMutex;
std::ofstream _MonitorStream;
#endif
mutable mp::SharedMutex _ThePathnameTranslationsMutex; // Protect _ThePathnameTranslations
mutable mp::SharedMutex _JITLogMutex; // Protect _jit logging
mutable mp::SharedMutex _UnixSignalHandlersMutex; // Protect _UnixSignalHandlers
mutable mp::SharedMutex _CodeBlocksMutex;
uint _StackWarnSize;
uint _StackSampleCount;
uint _StackSampleSize;
Expand Down Expand Up @@ -257,9 +257,7 @@ struct globals_t {
// ------------------------------------------------------------
// ------------------------------------------------------------
// ------------------------------------------------------------
globals_t() : _MakePackageCallback(NULL),
_ExportSymbolCallback(NULL),
_PathMax(CLASP_MAXPATHLEN),
globals_t() :
_ActiveThreadsMutex(ACTVTHRD_NAMEWORD),
_DefaultSpecialBindingsMutex(SPCLBIND_NAMEWORD),
_FinalizersMutex(MPSMESSG_NAMEWORD),
Expand All @@ -279,7 +277,10 @@ struct globals_t {
_ReplCounter(1),
_Bundle(NULL),
_DebugStream(NULL),
_SingleStepLevel(UndefinedUnsignedInt)
_SingleStepLevel(UndefinedUnsignedInt),
_MakePackageCallback(NULL),
_ExportSymbolCallback(NULL),
_PathMax(CLASP_MAXPATHLEN)
{
this->_GlobalInitializationCallbacks.clear();
this->_TraceLevel = 0;
Expand Down
5 changes: 4 additions & 1 deletion include/clasp/core/mpPackage.fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ class contention_free_shared_mutex {

public:
contention_free_shared_mutex() :
shared_locks_array_ptr(std::make_shared<array_slock_t>()), shared_locks_array(*shared_locks_array_ptr), want_x_lock(false), recursive_xlock_count(0),
want_x_lock(false),
shared_locks_array_ptr(std::make_shared<array_slock_t>()),
shared_locks_array(*shared_locks_array_ptr),
recursive_xlock_count(0),
owner_thread_id(thread_id_t()) {}

~contention_free_shared_mutex() {
Expand Down
19 changes: 15 additions & 4 deletions include/clasp/core/mpPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,21 @@ class Process_O : public core::CxxObject_O {
#endif
public:
Process_O(core::T_sp name, core::T_sp function, core::List_sp arguments, core::List_sp initialSpecialBindings = nil<core::T_O>(),
size_t stack_size = 8 * 1024 * 1024)
: _Parent(nil<core::T_O>()), _UniqueID(global_process_UniqueID++), _Name(name), _Function(function), _Arguments(arguments),
_InitialSpecialBindings(initialSpecialBindings), _ThreadInfo(NULL), _ReturnValuesList(nil<core::T_O>()), _Aborted(false),
_AbortCondition(nil<core::T_O>()), _StackSize(stack_size), _Phase(Nascent), _SuspensionMutex(SUSPBARR_NAMEWORD) {
size_t stack_size = 8 * 1024 * 1024) :
_UniqueID(global_process_UniqueID++)
, _Parent(nil<core::T_O>())
, _Name(name)
, _Function(function)
, _Arguments(arguments)
, _InitialSpecialBindings(initialSpecialBindings)
, _ReturnValuesList(nil<core::T_O>())
, _Aborted(false)
, _AbortCondition(nil<core::T_O>())
, _ThreadInfo(NULL)
, _Phase(Nascent)
, _SuspensionMutex(SUSPBARR_NAMEWORD)
, _StackSize(stack_size)
{
if (!function) {
printf("%s:%d Trying to create a process and the function is NULL\n", __FILE__, __LINE__);
}
Expand Down
8 changes: 6 additions & 2 deletions include/clasp/core/package.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ class Package_O : public General_O {

public:
// Not default constructable
Package_O() : _Nicknames(nil<T_O>()), _LocalNicknames(nil<T_O>()),
_Documentation(nil<T_O>()), _Lock(PACKAGE__NAMEWORD), _ActsLikeKeywordPackage(false)
Package_O() :
_ActsLikeKeywordPackage(false),
_Nicknames(nil<T_O>()),
_LocalNicknames(nil<T_O>()),
_Documentation(nil<T_O>()),
_Lock(PACKAGE__NAMEWORD)
{};

virtual void fixupInternalsForSnapshotSaveLoad( snapshotSaveLoad::Fixup* fixup ) {
Expand Down
6 changes: 3 additions & 3 deletions include/clasp/core/translators.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ template <>

DeclareType _v;
bool _val;
from_object( T_P o ) : _val( false ), _v( &_val ){};
from_object( T_P o ) : _v( &_val ), _val(false) {};
};

template <>
Expand All @@ -295,7 +295,7 @@ template <>

DeclareType _v;
bool _val;
from_object( T_P o ) : _val( false ), _v( &_val ){};
from_object( T_P o ) : _v(&_val), _val( false ) {};
~from_object() {/*non trivial*/};
};

Expand All @@ -306,7 +306,7 @@ template <>

DeclareType _v;
bool _val;
from_object( T_P o ) : _val( true ), _v( &_val ){};
from_object( T_P o ) : _v(&_val), _val( true ) {};
};

// TO_OBJECT TRANSLATORS
Expand Down
10 changes: 8 additions & 2 deletions include/clasp/core/wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ class WRAPPER_VariadicMethod <RT(OT::*)(ARGS...), Policies, ArgumentWrapper > :
enum { NumParams = sizeof...(ARGS)+1 };

WRAPPER_VariadicMethod(MethodType ptr, core::FunctionDescription_sp fdesc, core::T_sp code)
: mptr(ptr), core::GlobalSimpleFunBase_O(fdesc,core::ClaspXepFunction::make<MyType>(),code) {
:
core::GlobalSimpleFunBase_O(fdesc,core::ClaspXepFunction::make<MyType>(),code),
mptr(ptr)
{
this->validateCodePointer((void**)&this->mptr,sizeof(this->mptr));
};

Expand Down Expand Up @@ -190,7 +193,10 @@ class WRAPPER_VariadicMethod < RT(OT::*)(ARGS...) const, Policies, ArgumentWrapp
enum { NumParams = sizeof...(ARGS)+1 };

WRAPPER_VariadicMethod(MethodType ptr, core::FunctionDescription_sp fdesc, core::T_sp code)
: mptr(ptr), core::GlobalSimpleFunBase_O(fdesc,core::ClaspXepFunction::make<MyType>(),code) {
:
core::GlobalSimpleFunBase_O(fdesc,core::ClaspXepFunction::make<MyType>(),code),
mptr(ptr)
{
this->validateCodePointer((void**)&this->mptr,sizeof(this->mptr));
};

Expand Down
8 changes: 4 additions & 4 deletions include/clasp/gctools/gcweak.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ class WeakKeyHashTable {
typedef gctools::GCBucketAllocator<ValueBucketsType> ValueBucketsAllocatorType;

public:
core::Number_sp _RehashSize;
double _RehashThreshold;
size_t _Length;
gctools::tagged_pointer<KeyBucketsType> _Keys; // hash buckets for keys
size_t _Length;
core::Number_sp _RehashSize;
double _RehashThreshold;
gctools::tagged_pointer<KeyBucketsType> _Keys; // hash buckets for keys
gctools::tagged_pointer<ValueBucketsType> _Values; // hash buckets for values
#ifdef CLASP_THREADS
mutable mp::SharedMutex_sp _Mutex;
Expand Down
2 changes: 1 addition & 1 deletion include/clasp/gctools/memoryManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ struct ClaspInfo {
const char **_argv;
size_t _stackMax;
core::ThreadLocalState *_threadLocalStateP;
core::LispHolder *_lispHolder;
bool _mpiEnabled;
int _mpiRank;
int _mpiSize;
core::LispHolder *_lispHolder;

ClaspInfo(int argc, const char **argv, size_t stackMax)
: _argc(argc), _argv(argv), _stackMax(stackMax), _lispHolder(NULL), _mpiEnabled(false), _mpiRank(0), _mpiSize(1){};
Expand Down
5 changes: 4 additions & 1 deletion include/clasp/gctools/snapshotSaveLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ struct LibraryLookup {
uintptr_t _loadAddress;
std::string _libraryPath;

LibraryLookup( const std::string libraryPath ) : _libraryPath(libraryPath), _loadAddress(0) {};
LibraryLookup( const std::string libraryPath ) :
_loadAddress(0),
_libraryPath(libraryPath)
{};
std::map<std::string,uintptr_t> _symbolToAddress;
std::map<uintptr_t,std::string> _addressToSymbol;

Expand Down
6 changes: 3 additions & 3 deletions include/clasp/gctools/threadlocal.fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ namespace gctools {

struct GlobalAllocationProfiler {
std::atomic<int64_t> _BytesAllocated;
std::atomic<int64_t> _AllocationNumberCounter;
size_t _AllocationSizeThreshold;
size_t _AllocationNumberThreshold;
std::atomic<int64_t> _AllocationSizeCounter;
std::atomic<int64_t> _AllocationNumberCounter;
std::atomic<int64_t> _HitAllocationNumberCounter;
std::atomic<int64_t> _HitAllocationSizeCounter;
size_t _AllocationNumberThreshold;
size_t _AllocationSizeThreshold;
#ifdef DEBUG_MONITOR_ALLOCATIONS
MonitorAllocations _Monitor;
#endif
Expand Down
29 changes: 14 additions & 15 deletions include/clasp/gctools/threadlocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,26 +305,25 @@ struct VirtualMachine {
List_sp _BufferStrWNsPool;
StringOutputStream_sp _BFormatStringOutputStream;
StringOutputStream_sp _WriteToStringOutputStream;

MultipleValues _MultipleValues;
void* _sigaltstack_buffer;
size_t _unwinds;
stack_t _original_stack;
std::string _initializer_symbol;
void* _object_file_start;
size_t _object_file_size;
MultipleValues _MultipleValues;
void* _sigaltstack_buffer;
size_t _unwinds;
stack_t _original_stack;
std::string _initializer_symbol;
void* _object_file_start;
size_t _object_file_size;
gctools::GCRootsInModule* _GCRootsInModule;
StartupInfo _Startup;
bool _Breakstep; // Should we check for breaks?
StartupInfo _Startup;
bool _Breakstep; // Should we check for breaks?
// What frame are we stepping over? NULL means step-into mode.
void* _BreakstepFrame;
void* _BreakstepFrame;
// Stuff for SJLJ unwinding
List_sp _DynEnvStackBottom;
T_sp _UnwindDest;
size_t _UnwindDestIndex;
List_sp _DynEnvStackBottom;
T_sp _UnwindDest;
size_t _UnwindDestIndex;
#ifdef DEBUG_IHS
// Save the last return address before IHS screws up
void* _IHSBacktrace[IHS_BACKTRACE_SIZE];
void* _IHSBacktrace[IHS_BACKTRACE_SIZE];
#endif
size_t _xorshf_x; // Marsaglia's xorshf generator
size_t _xorshf_y;
Expand Down
10 changes: 5 additions & 5 deletions include/clasp/llvmo/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ typedef enum { SaveState, RunState } CodeState_t;
size_t _FasoIndex;
//
// Code data
//
gctools::GCRootsInModule* _gcRoots;
void* _TextSectionStart;
void* _TextSectionEnd;
Expand Down Expand Up @@ -101,21 +100,22 @@ typedef enum { SaveState, RunState } CodeState_t;
ObjectFile_O( core::SimpleBaseString_sp codename, JITDylib_sp jitdylib, size_t objectId ) :
_State(RunState),
_CodeName(codename),
_ObjectId(objectId),
_TheJITDylib(jitdylib),
_gcRoots(NULL),
_CodeBlock(unbound<CodeBlock_O>()),
_ObjectId(objectId) {
_CodeBlock(unbound<CodeBlock_O>())
{
DEBUG_OBJECT_FILES_PRINT(("%s:%d:%s codename = %s\n", __FILE__, __LINE__, __FUNCTION__, _rep_(codename).c_str() ));
};
ObjectFile_O( core::SimpleBaseString_sp codename, CodeBlock_sp codeBlock, JITDylib_sp dylib, size_t objectId) :
_State(RunState),
_CodeName(codename),
_ObjectId(objectId),
_TheJITDylib(dylib),
_gcRoots(NULL),
_CodeBlock(codeBlock),
_TextSectionStart(0),
_TextSectionEnd(0),
_ObjectId(objectId)
_CodeBlock(codeBlock)
{
DEBUG_OBJECT_FILES_PRINT(("%s:%d:%s created with CodeBlock_sp codename = %s CodeBlock = %s\n", __FILE__, __LINE__, __FUNCTION__, _rep_(codename).c_str(), core::_rep_(codeBlock).c_str() ));
};
Expand Down
5 changes: 4 additions & 1 deletion include/clasp/llvmo/debugInfoExpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,10 @@ struct from_object<llvm::Optional<llvm::DIFile::ChecksumInfo<llvm::StringRef>>,
}
}
from_object(const from_object& orig) = delete;
from_object(from_object&& orig) : _Storage(std::move(orig._Storage)), _v(orig._v) {
from_object(from_object&& orig) :
_v(orig._v),
_Storage(std::move(orig._Storage))
{
if (this->_v.hasValue()) {
// printf("%s:%d:%s from_object move ctor\n", __FILE__, __LINE__, __FUNCTION__ );
llvm::DIFile::ChecksumInfo<llvm::StringRef> checksum(this->_v->Kind,this->_Storage);
Expand Down
10 changes: 8 additions & 2 deletions include/clasp/llvmo/llvmoExpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -3858,9 +3858,15 @@ struct from_object<const llvm::StringRef, std::true_type> {
typedef llvm::StringRef DeclareType;
DeclareType _v;
string _Storage;
from_object(T_P object) : _Storage(gc::As<core::String_sp>(object)->get_std_string()), _v(this->_Storage) {};
from_object(T_P object) :
_v(this->_Storage),
_Storage(gc::As<core::String_sp>(object)->get_std_string())
{};
from_object(const from_object& orig) = delete;
from_object(from_object&& orig) : _Storage(std::move(orig._Storage)), _v(_Storage) {};
from_object(from_object&& orig) :
_v(_Storage),
_Storage(std::move(orig._Storage))
{};
};

template <>
Expand Down
6 changes: 5 additions & 1 deletion src/core/string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ struct StringCharPointer {
size_t _pos;
size_t _start;
typedef typename T::simple_element_type CharacterType;
StringCharPointer(const T* strP, size_t start) : _stringPtr(strP), _start(start), _pos(start) {}
StringCharPointer(const T* strP, size_t start) :
_stringPtr(strP)
, _pos(start)
, _start(start)
{}
inline size_t offset() { return this->_pos - this->_start;};
CharacterType operator*() {
CharacterType c = (*this->_stringPtr)[this->_pos];
Expand Down
8 changes: 4 additions & 4 deletions src/gctools/threadlocal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ bool DynamicBindingStack::thread_local_boundp(uint32_t index) const {

namespace gctools {
ThreadLocalStateLowLevel::ThreadLocalStateLowLevel(void* stack_top) :
_DisableInterrupts(false)
, _StackTop(stack_top)
_StackTop(stack_top)
, _DisableInterrupts(false)
#ifdef DEBUG_RECURSIVE_ALLOCATIONS
, _RecursiveAllocationCounter(0)
, _RecursiveAllocationCounter(0)
#endif

{};
Expand Down Expand Up @@ -193,8 +193,8 @@ VirtualMachine::~VirtualMachine() {
// in GC managed memory.
ThreadLocalState::ThreadLocalState(bool dummy) :
_unwinds(0)
,_CleanupFunctions(NULL)
,_PendingInterrupts()
,_CleanupFunctions(NULL)
,_ObjectFiles()
,_BufferStr8NsPool()
,_BufferStrWNsPool()
Expand Down

0 comments on commit 23ab1c5

Please sign in to comment.