4 ms·
I wonder if setjmp/longjmp can be implemented in hardware, i.e. introduce an instruction set that points, save and switch the current registers called register
by stevefan1999 4y ago
I wonder if setjmp/longjmp can be implemented in hardware, i.e. introduce an instruction set that points, save and switch the current registers called register window that can be switched by saving a pointer.
This way both setjmp and longjmp are basically few cycles and exception handling would be hella fast.
- snarfy 4y agoIntel has e.g. push all/pop all instructions. It doesn't save everything needed for setjmp/longjmp (like fpu state) but does a decent job.
- CalChris 4y agoThe DEC VAX-11 instruction set had SVPCTX and LDPCTX for the kernel which made context switch simple. But they were reserved instructions; so they couldn't be used for setjmp() and longjmp(). VAX-11 also had queue instructions which made rescheduling simple. This was basically: SETIPL SVPCTX INSQUE FFS REMQUE LDPCTX SETIPL Yeah, there was a little more. See page 188 of ... http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/vax/vms/training/EY-0016E-SG-0001_VMS_Internals_Student_Workbook_1982.pdf http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/vax/vms...