@kas1e
Quote:
Maybe you can help with that MachineStackMarker stuff, i.e those 3 parts of code need os4 analog to make js threading works:
You don't need any changes if you enable WTF_USE_PTHREADS, except for removing the OS(MORPHOS) parts, and with pthreads.library 53.11 or newer you don't need to disable HAVE_PTHREAD_RWLOCK.
You could use AmigaOS specific code instead, but why?
The MorphOS code makes no sense, unless it's a workaround for bugs in MorphOS, and it seems to be incomplete. For AmigaOS, and any AmigaOS compatible OS, you don't need PlatformThreadRegisters and can disable getPlatformThreadRegisters() and otherThreadStackPointer(), and use something like
void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread)
{
D(kprintf("gatherFromOtherThread\n"));
void* stackPointer = (struct Task *)(thread->platformThread)->tc_SPReg; //otherThreadStackPointer
void* stackBase = thread->stackBase;
swapIfBackwards(stackPointer, stackBase);
conservativeRoots.add(stackPointer, stackBase);
D(kprintf("stackPointer %p stackBase %p\n", stackPointer, stackBase));
}
suspendThread() should use IExec->SuspendTask(platformThread, 0) instead of Disable() which makes no sense at all (even for disabling multitasking completely instead of only stopping one task, which is wrong anyway, using IExec->Forbid() would have been enough) and resumeThread() IExec->RestartTask(platformThread, 0).
But since you always only post small, incomplete parts of the sources with which it's impossible to port it to AmigaOS you have to port it yourself if you don't want to use pthreads.