Commit Graph

775 Commits (ae3e48e1562fc1624f420c0607d4896afb65ed50)

Author SHA1 Message Date
Doug Coleman 262eb73ea6 basis: Re-enable some things I commented out. Fixes #22. Thanks @ajvondrak! 2012-12-31 11:48:30 -08:00
Doug Coleman a0dd953e33 starting point - Fix bootstrap; I broke it in merging. Disable environment variables because the compiler isn't loaded yet and can't call C ffi functions, and tools.test loads this vocab.
Disable intrinsics in cpu.x86.64 for now, since they invoke the compiler
Fix ##branch renaming to ##branch,
To work on this branch:
./factor -include=math -i=boot.image
./factor -run=listener
USE: compiler USE: tools.test save
enable-optimizer

Error message is now:
T{ vregs-shouldn't-interfere f 409 424 }
2012-12-31 11:03:45 -08:00
Doug Coleman 3582a6c624 kernel: Add 4dup, 4drop, and 4cleave. 2012-10-22 09:47:34 -07:00
John Benediktsson 3f947055b4 Revert "cpu.x86.bootstrap: Rice the jit compiler -- SHR SHL -> AND."
This reverts commit f43e2b1ba7.
2012-09-21 10:43:48 -07:00
Doug Coleman 4ee63bea7e cpu.x86.bootstrap: Rice the jit compiler -- SHR SHL -> AND. 2012-09-21 10:18:14 -07:00
Doug Coleman ba307bb38d cpu.x86.features: Rename rdrnd to rdrand! 2012-09-20 12:03:10 -07:00
Doug Coleman ed83c87554 cpu.x86: Add ghetto RDRAND support. Proper support wouldn't use alien-assembly and would take a count parameter. 2012-09-20 11:54:44 -07:00
Doug Coleman d196f8f141 cpu.x86: Use bit-range, don't call cpuid so many times 2012-09-19 15:44:20 -07:00
Doug Coleman e97c8971a5 cpu.x86: Some calls to CPUID take a parameter in ECX. Add cpuid-extended to allow these. 2012-09-19 11:30:54 -07:00
John Benediktsson e45f0ec9e2 cpu.x86.features: temporary fix for bootstrap issue. 2012-09-19 10:41:54 -07:00
Doug Coleman de52d96d93 cpu.x86.features: Add some words to check cpu features. Replace alien-assembly popcnt? instruction with general cpuid one. 2012-09-19 10:12:25 -07:00
Doug Coleman 1897f5fb4a cpu.x86.assember: Add RDMSR for completeness, but it can't be called from user code. Factor kernel modules? 2012-09-19 10:11:36 -07:00
Doug Coleman d52c0b1987 cpu.x86.features: Unbiased CPUID test. 2012-09-19 08:48:14 -07:00
Doug Coleman 9c0a8b3250 cpu.x86: Fix load order. 2012-09-19 08:40:18 -07:00
Doug Coleman 9827e29e95 cpu.x86.features: Fix cpuid for win64. 2012-09-18 20:09:39 -07:00
Doug Coleman 0d337e04ea cpu.x86.features: Implement cpuid with help from joe. Add unit test. 2012-09-18 18:51:32 -07:00
Doug Coleman 9ebd6c11ad cpu.x86: Fix the popcnt? word alien-assembly. XOR the return-reg RAX before calling BT/BSET because XOR clears the CF and the whole thing becomes a no-op. Change popcnt instruction to opt-out rather than opt-in. Fixes #663. 2012-09-18 17:15:03 -07:00
John Benediktsson 2f325e4fee using if-zero in even more places. 2012-07-16 19:38:49 -07:00
John Benediktsson d1f3b326e5 math: using if-zero in more places. 2012-06-18 14:32:39 -07:00
Joe Groff 9b56fbb1c1 cpu.x86.32.bootstrap: oops, meant bootstrap-cell 2011-12-19 20:55:07 -08:00
Joe Groff bc3f34cbd7 cpu.x86.32.bootstrap: update unwind-native-frames
The arguments passed from C are in a different position now.
2011-12-19 18:42:14 -08:00
Joe Groff b321c5656e cpu.x86.64: define jit-load-vm as a no-op
This was the signal handler prolog code can be shared completely between x86.32 and x86.64.
2011-12-14 11:33:05 -08:00
Joe Groff d62a0b28e6 oops, handler still need to jit-load-vm on x86-32 2011-12-14 09:56:50 -08:00
Joe Groff 7c9332e966 cpu.x86.*: clean up signal handler prolog code
Also bump the signal handler frame sizes up again since it looks like we shrank them too much.
2011-12-14 09:56:50 -08:00
Joe Groff 2eba1b5449 cpu.x86: reduce compiled frames by 2 cells too 2011-12-14 09:56:49 -08:00
Joe Groff 079025559d simplify function prologs 2011-12-14 09:56:49 -08:00
Joe Groff ee656387ea cpu.*.bootstrap: return address for (set-context)
Instead of pushing zero as the fake return address for a set-context call, push an address that points back into the primitive so that callstack walking can match the frame back to the subprimitive.
2011-12-14 09:56:46 -08:00
Joe Groff 1911905c6b vm: frame size for signal handler code blocks 2011-12-14 09:56:46 -08:00
Joe Groff e21f316583 vm: store stack frame size in code blocks
Change modify-code-heap primitive so it takes a sixth element in each array for the frame size.
2011-12-14 09:56:45 -08:00
Joe Groff d927a070ed cpu.x86: enable POPCNT with a flag
If bootstrapped with '-enable-popcnt' and the host CPU supports it, enable the POPCNT-based fixnum-bit-count intrinsic. Fixes #436.
2011-12-12 16:43:49 -08:00
Joe Groff 943596575a use radix literals 2011-11-23 19:03:40 -08:00
Joe Groff 6498bc65ce compiler: emit safepoints in optimized prologs 2011-11-23 11:11:25 -08:00
Joe Groff 248066c710 code beautification 2011-11-13 16:10:26 -08:00
Joe Groff d79b462f75 compiler: add intrinsic for PMOVMSKB/MOVMSKP[SD]
Combined with a fast bit-count this will let us rice byte-counting.
2011-11-13 16:10:20 -08:00
Joe Groff e0dc236725 cpu.*.bootstrap: clear faulting flag directly
No reason to go through a safepoint in unwind-native-frames really.
2011-11-12 13:02:57 -08:00
Joe Groff e24400679f vm: more defense against multi-faulting
* Clear faulting_p from a safepoint rather than inside general_error, because jumping into unwind-native-frames could blow up.
* Handle multiple faults from fatal_error by breakpointing. Is there anything else we can safely do at that point?
* Verify memory protection faults in the top half of the signal handlers because signal dispatch could fault. Treat memory faults during gc or fep as fatal errors.
* Add a function factor_vm::abort() that restores the default SIGABRT handler and ::abort()s. Use it from fatal_error() so we get useful context from gdb and so the user gets feedback from the system crash reporter that Factor blew up and didn't just disappear.
* In factorbug(), don't proceed with .s .r .c if it would be unsafe to do so.
* Don't pile on signals if we've already called fatal_error().
2011-11-12 13:02:57 -08:00
Joe Groff c31530caec vm: strip out call-counting profiler
This makes the separate "code" and "entry_point" fields in word and quotation redundant, so also remove them to reclaim an additional cell per word and quotation object, which should help with #318.
2011-11-10 16:01:07 -08:00
Joe Groff c736b04ada cpu.x86.*.bootstrap: save flags in signal-handlers 2011-11-04 11:56:01 -07:00
Joe Groff a934b7f3e5 cpu.x86.bootstrap: cell -> bootstrap-cell 2011-11-04 11:54:40 -07:00
Joe Groff 4ef2a9b4f0 cpu.x86.assembler: PUSHF, POPF instructions 2011-11-04 11:23:11 -07:00
Joe Groff d9293337bb cpu.x86.64.bootstrap: save all the regs on signal
Appears to fix another sporadic crash from mason on x86-64. There's no reason to cut corners here, really.
2011-11-04 10:01:56 -07:00
Joe Groff 1bc623167f cpu.x86.bootstrap: don't safepoint in a safepoint
Safepointing in the signal-handler primitive causes a crash if the safepoint is guarded and the signal being handled was raised by a safepoint. Put our own RET in the subprimitive to bail out before the standard epilog gets written out. This tentatively appears to fix #349.
2011-11-03 20:19:38 -07:00
Joe Groff e201f3562f cpu.x86.32.bootstrap: typo 2011-11-03 13:07:13 -07:00
Joe Groff 6bb46a3f1e vm: always generate safepoints in jit
Even if there's no stack frame we still need to safepoint before leaving the function. Fixes #332.
2011-11-03 11:57:43 -07:00
Joe Groff 8cf18d1a82 remove BSD,solaris,etc. misc platform support code 2011-11-02 17:13:51 -07:00
Joe Groff 252915a37c fix platform dependency in leaf-signal-handler 2011-11-02 13:23:12 -07:00
Joe Groff 9f6f36fdec cpu.x86.bootstrap: simplify leaf-signal-handler
We can use RET (stack-frame-size - cell) instead of doing stack gymnastics.
2011-11-02 13:23:08 -07:00
Doug Coleman 94db86a6db Make "foo.private" require load foo instead.
Move require from vocabs.loader to vocabs. Update everything.
Fixes #201.
2011-11-02 11:50:03 -07:00
Joe Groff 2d5360778f cleanups from code review 2011-10-27 21:18:23 -07:00
Joe Groff c70a1004f8 cpu.x86.64: also must save ctx-reg 2011-10-27 21:18:21 -07:00