Commit Graph

1937 Commits (master)

Author SHA1 Message Date
Björn Lindqvist 5826394573 VM: the (clear-samples) primitive is unused 2016-05-05 02:33:35 +02:00
Björn Lindqvist bc9f62efde VM: using a c++ lambda over a struct 2016-05-05 01:57:52 +02:00
Björn Lindqvist 8911ad2a16 VM: don't end the gc event in start_gc_again, fixes #659 2016-05-04 22:47:50 +02:00
Björn Lindqvist 583fb5825b VM: removes the collector class
The cheneys_algorithm() method can be moved to slot_visitor (because it
kind of visists objects), and then there is no need for the collector
class.
2016-05-04 17:52:04 +02:00
Björn Lindqvist f629a95b03 VM: moving collector methods to slot_visitor methods
collector::trace_cards moved to slot_visitor::visit_cards and
collector::trace_code_heap_roots moved to
slot_visitor::visit_code_heap_roots. Both those methods are pointer visitors
2016-05-04 00:32:17 +02:00
Björn Lindqvist 4cc5e90605 VM: SNPRINTF macro is not used 2016-05-02 15:01:49 +02:00
Björn Lindqvist 2035eb91fe VM: method compute_identity_hashcode is not needed 2016-05-02 14:05:01 +02:00
Björn Lindqvist eb8b7f02bf VM: the start_factor method isn't needed 2016-05-01 23:36:41 +02:00
Björn Lindqvist 58ad5fb4ce VM: all the started_<blah>() replaced with reset_timer() 2016-04-24 15:21:17 +02:00
Björn Lindqvist 82e2de5e12 VM: oops, fix compilation error i caused 2016-04-24 15:18:45 +02:00
Björn Lindqvist c55af9b957 VM: object_size, compute_entry_point_address, code_block_owner made into
functions

It is to make the vm class less heavy
2016-04-24 14:45:03 +02:00
Björn Lindqvist 82658e184f VM: make return_takes_param() a function 2016-04-24 14:19:35 +02:00
Björn Lindqvist 28b5378196 VM: merge of fixup_data & fixup_code into a new method fixup_heaps 2016-04-24 12:42:22 +02:00
Björn Lindqvist c8d648f3f2 VM: the factor_vm::code_blocks() method isn't needed 2016-04-22 12:01:26 +02:00
Björn Lindqvist bcc32291e8 VM: merge of free_list_allocator.hpp into free_list.hpp
It's better if all the free list stuff is in a single header.
2016-04-22 12:01:26 +02:00
Björn Lindqvist a23bb8cf16 VM: nr of code blocks scanned always = points_to_<gen>.size() 2016-04-22 12:01:26 +02:00
Björn Lindqvist 70e7bad921 VM: parent and code attrs in collector struct is not used 2016-04-22 12:01:26 +02:00
Björn Lindqvist da4812ba21 VM: refactoring which removes two not useful short methods 2016-04-04 23:32:23 +02:00
Doug Coleman b324c30cc7 vm: Fix four compile warnings reported by gcc with -pedantic flag. 2016-03-30 15:39:42 -07:00
Björn Lindqvist 10ac4da0f6 VM: fixes to make some if-else statements read better 2016-03-31 00:37:59 +02:00
John Benediktsson 02956a25ce vm: compact-gc was checked twice. 2016-03-28 22:28:57 -07:00
Björn Lindqvist 9a531076f0 VM: improved vm_executable_path which works for arbitrary long paths 2016-03-23 16:15:30 +01:00
Björn Lindqvist 83e1ee5084 VM: fix string copying to not use PATH_MAX here 2016-03-23 16:15:29 +01:00
Björn Lindqvist 4f33f22b56 VM: on errors, only dump the heap if it has been initialized 2016-03-23 01:56:40 +01:00
Björn Lindqvist 579875821b VM: removes the OBJ-ERROR special object in favor of a constant
The special object contained the string "kernel-error" which were used
to tag VM errors. But it is simplier and removes a little complexity to
just tag them with a fixnum constant.
2016-03-22 17:52:19 +01:00
Björn Lindqvist 2f1e963587 Build: never dynlink with gui libs 2016-03-11 05:17:04 +01:00
Doug Coleman 7488e54825 math.cpp: Fix two warnings. Fixes #1549. 2016-03-08 10:02:28 -08:00
Jon Harper 13ba081ac8 primitive_format_float, return empty string on bad locale instead of C++ exception 2016-03-08 07:55:25 -08:00
Jon Harper 19fadb6c96 prettyprinter, locale independant float printing 2016-03-08 07:55:25 -08:00
Doug Coleman 5813e8384e command-line.startup: document more command line flags. we already have -nosignals, but it was hidden in the source code. Fix spacing for default image. Closes #1514. 2016-03-03 17:16:39 -08:00
Doug Coleman 67eb64cf00 vm/contexts.cpp: We are only deleting half the contexts because we increment the iter twice per loop! Fixes #1534. Thanks clang! 2016-03-01 00:19:43 -08:00
Björn Lindqvist 44b9b26baa VM: nitpick fix of filenames in comments 2016-02-28 01:23:59 +01:00
Björn Lindqvist 2db1e7e6a5 VM: simplifies factor_vm::determine_inline_cache_type 2016-02-28 01:10:12 +01:00
Björn Lindqvist 0c9c0b2f82 VM: removes a few methods related to relocation handling
They are only used once, so it is simpler to "inline" them
2015-12-13 13:56:36 +01:00
Björn Lindqvist 7da72ac77c VM: the compute_vm_address method can be removed 2015-12-13 13:56:36 +01:00
Björn Lindqvist 08766090d3 VM: more fine-grained control over which special objects to save
It removes a few roots that doesn't need to be saved in the image and
can save a few hundred bytes.
2015-12-13 13:56:36 +01:00
Björn Lindqvist 46bfcbf3a2 VM: the rel_type() and rel_offset() accessors in instruction_operand can be removed 2015-12-13 13:56:36 +01:00
Björn Lindqvist 1a72f731e0 VM: now special-objects is used for -1, 0, 1 and t
The fields in the image_header aren't read or written to but I haven't
changed the format yet.
2015-12-10 10:22:38 +01:00
Björn Lindqvist 339b1b6466 VM: put the singletons t, -1, 0 and 1 in the special objects table
Having them there instead of as fields in the vm struct removes a bunch
of special handling. This commit just adds them and doesn't remove the
old ones to avoid potential chicken-and-egg bootstrap problems.
2015-12-09 21:31:13 +01:00
Björn Lindqvist d911bc45fd VM: refactors the prepare_boot_image method
easier to read if the methods compile_all_words and
initialize_all_quotations which are only used once are "inlined"
2015-12-04 13:57:57 +01:00
Björn Lindqvist 867c85f1c5 VM: can't go through the accessor here because it triggers the assert 2015-11-25 18:12:55 +01:00
Björn Lindqvist 0274e889b9 VM: refactor tagged.hpp so it's not dependent on the factor_vm class
this way untag<byte_array>(relocation) can be used in code_blocks.hpp
2015-11-24 16:00:50 +01:00
Björn Lindqvist 22bb0cfecf VM: fixes to use the TAG macro over tagged<object>(obj).type() 2015-11-23 02:27:22 +01:00
Björn Lindqvist a8aaa42882 VM: refactoring to use the TAG macro directly over the tagged struct
eg. TAG(obj) is equivalent to tagged<object>(obj).type()
2015-11-22 23:42:54 +01:00
Björn Lindqvist 575da3e478 VM: fix so that errno is set if MoveFileEx fails, should fix #1490 2015-10-12 12:19:21 +02:00
Björn Lindqvist 7dfb352a7e VM: replaced calls to out_of_memory() with fatal_error()
No need for a special out of memory function -- it's just a kind of
fatal  error. Also make fatal_error() call dump_memory_layout() for
easier debugging.
2015-10-08 20:46:17 +02:00
Björn Lindqvist cb55fcf20f VM: prettier and more detailed output when dumping generations 2015-10-08 16:25:35 +02:00
Doug Coleman 7eec8621aa vm: MoveFileEx returns BOOL which needs help converting to C++ bool. 2015-10-01 17:04:13 +00:00
John Benediktsson bd04290187 vm: fix signature for safe_fopen. 2015-09-30 19:03:39 -07:00
Björn Lindqvist 85784c5265 VM: make save-image throw exception on error (#1090) 2015-09-30 23:31:47 +02:00
Björn Lindqvist 2536b6cd93 VM: fix move_file called from save_image
save_image() shouldn't throw exceptions because if the 'then_die'
argument is t it would leave factor in an inconsistent state. So
therefore move_file() should be fixed and raw_fclose() called instead of
safe_fclose().
2015-09-29 23:13:10 +02:00
Björn Lindqvist 40eb664425 VM: simplified save_image, goto works here! 2015-09-29 23:13:09 +02:00
Björn Lindqvist ffc441ad63 VM: looks like ERROR_C_STRING is never thrown, so it can be removed 2015-09-29 23:12:56 +02:00
Björn Lindqvist 614595bd9a VM: workhorse attribute not used 2015-09-22 08:51:03 +02:00
Björn Lindqvist b3de115e3c VM: remove RT_EXCEPTION_HANDLER reference 2015-09-02 21:54:47 +02:00
Björn Lindqvist 769c09def5 VM: for consistency, it is easier to put all functions in the exports file 2015-09-02 21:54:44 +02:00
Björn Lindqvist bc7f9ee669 VM: always use undecorated names when loading ffi functions
For win32, Factor tries four different function names when loading
stdcall and fastcall functions, in case decorated names are used in the
dll. It seems to not be necessary because a dll meant for 3rd party use
will always export undecorated
names (http://blogs.msdn.com/b/oldnewthing/archive/2004/01/12/57833.aspx).
2015-09-02 21:54:41 +02:00
Björn Lindqvist da3de080ee VM: callback_entry_point() and update() can be removed 2015-09-02 21:54:39 +02:00
Björn Lindqvist de4917e6a1 VM: give the exception handling special object a real name 2015-09-02 21:54:33 +02:00
Björn Lindqvist 22887c5816 VM: get rid of the odd RT_EXCEPTION_HANDLER relocation
The address to the win32 relocation handler can be stored in a special
object and be accessed by jit-install-seh. Doing it that way is better
because you can remove a lot of special code related to that relocation
type.
2015-09-02 21:54:30 +02:00
Björn Lindqvist 68c0c0f53a VM: clear commented out code 2015-09-02 21:54:27 +02:00
Björn Lindqvist 84ec2164c2 VM: nicer way of initializing those special objects that are aliens 2015-09-02 21:54:18 +02:00
Björn Lindqvist cee0b19324 VM: the ffi-signal-handler and ffi-leaf-signal-handler primitives are unused 2015-09-02 21:54:15 +02:00
Björn Lindqvist a9c33cbfd7 VM: better way to set signal_resumable 2015-08-26 20:23:28 +02:00
Björn Lindqvist 663e5e2a09 VM: fix jit-signal-handler-prolog/epilog to account for the home space
Windows 64bit abi requires callers to reserve 32 bytes of home space in
the stack frame which the callee is free to clobber. Previous versions
of VS didn't compile code to take advantage of the home space so it
worked fined. VS2015 however, is using the home space which causes
registers and flags that were supposed to be saved to be
overwritten. The fix is to put a little extra empty space at the bottom
of the stack frame.
2015-08-26 20:23:25 +02:00
Björn Lindqvist 316b16f377 VM: instead of enqueue_safepoint() just call set_safepoint_guard() directly 2015-08-26 20:23:23 +02:00
Björn Lindqvist 5a39631b4b VM: refactoring, new function get_thread_pc() and simpler logic in exception_handler() 2015-08-26 20:23:20 +02:00
Björn Lindqvist 2a852915d2 VM: signal_fault_pc probably should be set here... 2015-08-26 20:23:17 +02:00
Björn Lindqvist 10464e7e4e VM: LEAF_FRAME_SIZE is 16 bytes on all platforms so we can simplify it 2015-08-26 20:23:15 +02:00
Björn Lindqvist cb0bf3b1ce VM: merge memory_protection_error() with memory_signal_handler_impl() 2015-08-24 07:23:40 -07:00
Björn Lindqvist 39c888230a VM: new function set_safepoint_guard to replace the functions (un)guard_safepoint 2015-08-24 07:23:40 -07:00
Björn Lindqvist 56ddb59b00 VM: new function set_memory_locked(true/false)
it wraps the mprotect/VirtualProtect platform differences and makes it
so you can unify some windows/unix code path forks
2015-08-24 07:23:40 -07:00
Björn Lindqvist 94eb855903 VM: make the debug output a little prettier 2015-08-24 07:23:40 -07:00
Björn Lindqvist 51daaf6be4 VM: the windows_image_path method is unused 2015-08-24 07:23:40 -07:00
Björn Lindqvist 4efef7bfd9 VM: merge the compute_dlsym_toc_address() with the
compute_dlsym_address() method

it makes the code slightly more cluttered but you get rid of a lot of
special casing for the ppc platform
2015-08-23 18:36:31 -07:00
Björn Lindqvist a53d5be683 VM: make allot_alien() and ffi_dlsym() use cell instead of void*
this way we get rid of a bunch of superfluous casts
2015-08-23 18:36:31 -07:00
Björn Lindqvist 1045f41778 VM: gc required here because we are iterating all objects 2015-08-23 18:36:31 -07:00
Björn Lindqvist 7f545271f4 VM: new iteration method each_object_each_slot()
used by find_data_references() and dump_edges() instead of the functor structs
2015-08-23 18:36:31 -07:00
Björn Lindqvist 59b7a50567 VM: removing the get_datastack/retainstack/callstack primitives
they can all be implemented using the
datastack/retainstack/callstack-for primitives and the less primitives
the better!
2015-08-23 18:36:30 -07:00
Björn Lindqvist 883f65d0e4 VM: fix one callstack overflow problem by "unlocking" the callstacks
border pages

Also a new vocab compiler.tests.callstack-overflow which is supposed to
contain all tests for callstack overflow-related problems.
2015-08-14 20:19:58 -07:00
Björn Lindqvist 59762009f1 VM: simplified logic for allot_object() 2015-08-14 20:19:57 -07:00
Björn Lindqvist 1b1b275a1a VM: simplifies the dispatch_resumable_signal() method 2015-08-14 20:19:57 -07:00
Björn Lindqvist b8aef640f9 VM: new method set_border_locked() in segment, so that you can remove
the protection of the guard pages
2015-08-14 20:19:56 -07:00
Björn Lindqvist 5d7fb5da60 VM: smaller style-fixes, like removing redundant else clauses and this prefixes 2015-08-14 20:19:55 -07:00
Björn Lindqvist e14d820138 VM: move trace_partial_objects to visit_partial_objects since it is a
kind of visitation function
2015-08-14 20:19:55 -07:00
Björn Lindqvist df669298ce VM: split dispatch_signal_handler into two methods, one for resumable
and one for non-resumable signals
2015-08-14 20:19:55 -07:00
Björn Lindqvist 2b1c6ca11a VM: move the frame_predecessor() method to the code_heap class 2015-08-14 20:19:54 -07:00
Björn Lindqvist f3c34e44d4 VM: FRAME_RETURN_ADDRESS define unused 2015-08-14 20:19:54 -07:00
Björn Lindqvist 9413f711b9 VM: the JIT_PROFILING special object is never used, so rename it to
JIT_UNUSED (removing it breaks boot images)
2015-08-14 20:19:53 -07:00
Björn Lindqvist 3f9fa7e39e VM: emit_prolog/emit_epilog can be simplified because stack frame and
safe point is always emitted together
2015-08-14 20:19:51 -07:00
Björn Lindqvist 358fae93c9 VM: the stack_frame_p() and safepoint_p() functions appear to be
semantically identical, let's merge them into a
no_non_safepoint_words_p() function
2015-08-14 20:19:50 -07:00
Björn Lindqvist 510193f012 VM: an unused #define we can eliminate 2015-08-14 20:19:50 -07:00
Björn Lindqvist 81057c4108 VM: the context_object_count must be wrong, there are only 4 of them 2015-08-14 20:19:50 -07:00
Doug Coleman 9f43820076 Revert "vm: don't use implicit this. thanks to Jon Harper for the report."
My bad. A buggy compiler is a buggy compiler. Not a good workaround.

This reverts commit 1602e5094c.
2015-08-14 11:15:55 -07:00
Doug Coleman 1602e5094c vm: don't use implicit this. thanks to Jon Harper for the report. 2015-08-14 10:16:53 -07:00
Doug Coleman dcc1e7773f contexts.hpp: Increase callstack reserve space to 16k for Mac64. Fixes issue #1419. 2015-08-04 12:43:24 -07:00
John Benediktsson 5c0d8c7e4f vm: minor fixes. 2015-08-04 07:49:50 -07:00
Björn Lindqvist 22bd11c4a4 VM: fix silly compile error 2015-08-04 16:02:10 +02:00
Björn Lindqvist 6fedb79c73 VM: bump stack_reserved from 1kb to 4kb
The added test case fails with a doulbe fault, which appears to be
caused by a stack overflow in the code that tries to handle the stack
overflow. So bumping it to 4096 bytes should give the code enough stack
space to play with.
2015-08-04 16:02:10 +02:00
Björn Lindqvist beb71ce49b VM: merge full_collector.hpp into full_collector.cpp 2015-08-04 16:02:10 +02:00
Björn Lindqvist a7757eed41 VM: new method context::address_to_error 2015-08-04 16:02:10 +02:00
Björn Lindqvist 504be0c7cb VM: signal_error and fp_trap_error not needed, call general_error directly 2015-08-04 16:02:10 +02:00
Björn Lindqvist 73956db33a VM: a bunch of methods on factor_vm that can be converted into free
functions

I think that makes it easier to see whats going on than having
everything added to factor_vm
2015-08-04 16:02:09 +02:00
Björn Lindqvist ae725b737a VM: lets merge entry_points.hpp with vm.hpp, so you have one less header
file to worry about
2015-08-04 16:02:09 +02:00
Björn Lindqvist 282c52b872 VM: you can insert the write_barrier() the first time you interate the
blocks, so you don't need to do it twice
2015-08-04 16:02:09 +02:00
Björn Lindqvist 03d861976c VM: new method visit_instruction_operands(), it replaces the instruction
operand iteration code in compaction.cpp and image.cpp
2015-08-04 16:02:09 +02:00
Björn Lindqvist e565b0291f VM: refactors slot_visitor by removing a lot of one-use methods
I think it's easier to see the code flow if small method bodies that are
only called once are inlined into visit_all_roots() instead
2015-08-04 16:02:09 +02:00
Björn Lindqvist f5f8ce1501 VM: word_stack_frame_p() is not used and find_all_quotations() is
trivial so those methods can be removed
2015-08-04 16:02:09 +02:00
Björn Lindqvist 49a406d880 VM: using compute_external_address everywhere instead of store_external_address 2015-08-04 16:02:09 +02:00
Björn Lindqvist 50318a6f77 VM: new method compute_external_address 2015-08-04 16:02:08 +02:00
Björn Lindqvist 718ea51d8a VM: remove the collect_compact_code_impl(), collect_compact_impl() can
be used instead

this might slow down collect_growing_heap(), but heap growth happens so
rarely that it shouldn't matter
2015-08-04 16:02:08 +02:00
Björn Lindqvist b44db91f65 VM: init_code_heap is trivial and only used once, so let's remove it 2015-08-04 16:02:08 +02:00
Björn Lindqvist 18ab09e493 VM: object_compaction_updater -> lambda func 2015-08-04 16:02:08 +02:00
Björn Lindqvist 9049aa1f65 VM: another opportunity to use a lambda function over a struct 2015-08-04 16:02:08 +02:00
Björn Lindqvist a5a7232b8f VM: use a function update_relocation to replace the
code_block_compaction_relocation_visitor struct
2015-08-04 16:02:08 +02:00
John Benediktsson b065d6172d vm: rename emit_quot to emit_quotation. 2015-07-15 11:21:20 -07:00
John Benediktsson 4c2c8f133f vm: rename some primitives, and some cleanup.
* quot-compiled? => quotation-compiled?
* optimized? => word-optimized?
2015-07-15 11:13:52 -07:00
Björn Lindqvist b9b75c272b VM: let's merge (save-image) and (save-image-and-exit) into one 3
arg (save-image). it's good not to have to many similar primitives
2015-07-12 22:36:59 +02:00
Björn Lindqvist d608f3377b VM: get_entry_point is unused 2015-07-12 22:36:59 +02:00
Björn Lindqvist c69e1a6e93 VM: move the paths out of gc memory so that they arent unnecessarily
added to the image
2015-07-12 22:36:59 +02:00
John Benediktsson 801fdebde2 vm: bring back FACTOR_ASSERT. 2015-07-06 15:18:09 -07:00
Björn Lindqvist 4bc0720e51 VM: more changes of structs to lambda functions 2015-07-06 22:49:38 +02:00
Björn Lindqvist 4dfac78fc1 VM: move changes of structs to lambda functions 2015-07-06 22:49:38 +02:00
Björn Lindqvist 365b39e0cc VM: change lot of visitation objects to use cool lambda functions instead 2015-07-06 22:49:38 +02:00
Björn Lindqvist fce5d4353a VM: replace binary_payload_start() with slot_count()
This should simplify a little the address calculations when visiting
slots of an object
2015-07-06 22:49:38 +02:00
Björn Lindqvist 46423dfebf VM: merge strings.hpp and tuples.hpp into layouts.hpp, because those
header files were so tiny
2015-07-06 22:49:38 +02:00
Björn Lindqvist 66eb9f1fe5 VM: split the size() method into base_size() and aligned_size() 2015-07-06 22:49:38 +02:00
Björn Lindqvist ed702209ce VM: fix bignum>fixnum-strict conversion, previously most-negative-fixnum
>bignum bignum>fixnum-strict didn't work
2015-06-29 08:19:42 +02:00
Björn Lindqvist 35b04f8ec1 VM: fixes a bug with the handling of 0 bignums, and declares bignum/mod
to maybe output fixnums
2015-06-27 16:14:58 +02:00
Björn Lindqvist 2f835d3666 compiler.tree.propagation.*: implements downgrading to fixnum for the
mod word, maybe a first step in solving #224

factor_vm::primitive_bignum_mod is changed so that it outputs a fixnum
if the value is small enough. Then the compiler can take advantage of
knowing that expressions like [ >bignum 10 mod ] always result in a
fixnum [-9,9] and inline more arithmetic.
2015-06-27 16:14:58 +02:00
Björn Lindqvist e14d7a3508 VM: make the bignum_to_* family free functions, they don't need to be
members of factor_vm
2015-06-27 16:14:58 +02:00
Doug Coleman 31fe045560 vm: differentiate which strerror is printing the message. 2015-06-08 17:58:00 -07:00
Doug Coleman 1d58f827a2 platform.hpp: Indent so I can see wtf is going on with the preprocessor control flow.
Look for ``__linux__`` on linux instead of ``linux`` because compiling with
-std=c++11 removes the ``linux`` preprocessor symbol.
2015-06-05 10:53:02 -07:00
Doug Coleman a83df49ecc ffi_test.c: Casting a 32bit int to a 64bit pointer is invalid. Instead,
cast it to a 64bit int then to the pointer. Found with visual studio 2015.
2015-06-05 10:21:20 -07:00
Doug Coleman f26c7fc66d utilities.hpp: Use auto pointer instead of gcc extension typeof().
Fixes #1336.
2015-06-05 10:20:32 -07:00
Björn Lindqvist 40b7805e0a VM: fixes so that raw_fread and safe_fread returns a size_t again 2015-06-05 02:14:49 +02:00
Björn Lindqvist 428937dbeb VM: make FACTOR_FOR_EACH not call .end() more than once 2015-06-05 02:14:49 +02:00
Björn Lindqvist 0713f28bdb VM: safe_fread needs to return an int so you can return -1 on error 2015-06-05 02:14:49 +02:00
Björn Lindqvist a0e7bb8770 VM: move free_list_allocator<Block>::next_allocated_block_after to
tenured_space::next_allocated_object_after, because it's only used there
2015-06-05 02:14:49 +02:00
Björn Lindqvist f1ca83524a VM: new functions raw_fclose and raw_fread
These need to be used when the image is loaded because there is no
context so you can't throw io errors yet.
2015-06-05 02:14:49 +02:00
Björn Lindqvist 9d289e35f4 VM: macro FACTOR_FOR_EACH used in more places to drive iteration 2015-06-05 02:14:49 +02:00
Björn Lindqvist b7bd0668b3 VM: macro FACTOR_FOR_EACH to make stl container iteration easier to express 2015-06-05 02:14:48 +02:00
Doug Coleman 27590b514c vm: Only call fclose() once. Rename io_error() to io_error_if_not_EINTR() to be more explicit.
Fixes #1335.
2015-06-03 14:35:48 -07:00
Björn Lindqvist 8e1f3a0e51 VM: after reset_datastack and retainstack clear the stack segment. makes
it easier to find bad accesses to shadow data
2015-05-22 12:22:28 -07:00
Björn Lindqvist 183ec83a6d VM: possible fix for #1319.
Fix for reset_context() so that the top two stack items are never
removed from the stack so if the parent->init_context(ctx) call triggers
a GC, those items are never collected.
2015-05-22 12:22:27 -07:00
Björn Lindqvist 016614747d VM: the delete_context() and reset_context() api functions can be
simplified a bit

The functions always operates on parent->ctx, so passing a context*
parameter is redundant. This enables shorter assembly code for
the (start-context-and-delete) and (set-context-and-delete) primitives.
2015-05-22 12:22:26 -07:00
Björn Lindqvist 6ca83e7588 Reorganising bootstrap files
All the bootstrap.factor scripts in cpu/ are run by the bootstrap to
make boot images, but aren't used otherwise. So I think it's cleaner to
put them in one directory inside the bootstrap hierarchy.
2015-05-22 12:22:24 -07:00
Björn Lindqvist bf7161604e VM: simplified logic in data_heap_checker 2015-05-17 07:59:34 +02:00
Björn Lindqvist 3887b58c02 VM: cleanups, like removing redundant paranthesis and removing method
declarations that doesn't exist
2015-05-09 20:04:22 -07:00
Björn Lindqvist a6e2834252 VM: refactoring to use the visit_object_array method 2015-05-09 20:04:21 -07:00
Björn Lindqvist 0a6486ef78 VM: the aging_policy and nursery_policy classes are so small that they
can be in the same cpp file with the methods that use them
2015-05-09 20:04:21 -07:00
Björn Lindqvist e4bb3058e0 VM: the copying_collector only contained one method, so it can easily be
merged with its base class
2015-05-09 20:04:21 -07:00
Björn Lindqvist 685a795aa0 VM: to_tenured_collector isn't needed, it's just a normal collector instance 2015-05-09 20:04:21 -07:00
Björn Lindqvist 9bfc43144e VM: debug macros FACTOR_PRINT and FACTOR_PRINT_MARK to make better debug
printing messages than just using std::cout
2015-05-09 20:04:21 -07:00
Björn Lindqvist fa0ff77c45 VM: reset the unused parts of the data and retain stack segments with a bit pattern (good for debugging) 2015-04-29 09:31:54 -07:00
Björn Lindqvist acc1bd3221 compiler.*: removing the check-d and check-r slots from gc-map and adjusting code that depended on those 2015-04-29 09:31:53 -07:00
Björn Lindqvist 2cd2aa498a VM: the compiler doesn't emit any live overinitialized locations anymore
Any overinitialized location immediately becomes garbage and is not
reused again. This is very nice because then the gc maps can be
simpler again.
2015-04-29 09:31:53 -07:00
Björn Lindqvist 1d251f7b6a VM: new function visit_object to replace trace_object 2015-02-28 14:14:30 -08:00
Björn Lindqvist 6b29c0ea00 VM: refactoring to remove redundancy in retainstack|datastack_to_array 2015-02-28 14:14:30 -08:00
Björn Lindqvist 0798928996 VM: cleanup of some infrequently used functions that can be replaced with direct code
also replacing some bitshifts with easier to understand multiplies and
divides, they are equally fast nowadays
2015-02-28 14:14:30 -08:00
Björn Lindqvist ab75e3b05d VM: splits out the little ugly scan_next-object + goto-loop into a function trace_card() 2015-02-28 14:14:30 -08:00
Björn Lindqvist 8e91ca3e31 VM: simplification of the trace_partial_objects function 2015-02-28 14:14:30 -08:00
Björn Lindqvist a43a455990 VM: the unmarker classes are not needed, easier to just send the unmask pattern to the trace_cards function directly 2015-02-28 14:14:30 -08:00
Björn Lindqvist b5a206c587 VM: new function visit_mark_stack() to factor out the mark stack iteration 2015-02-28 14:14:29 -08:00
Björn Lindqvist 667e5768ba VM: it's confusing that slot_visitors are called "workhorse" sometimes, let's standardize the name "visitor" 2015-02-28 14:14:29 -08:00
Björn Lindqvist 5490c50217 VM: visit_roots and visit_contexts where always called in tandem, make a new method visit_all_roots that calls them both 2015-02-28 14:14:29 -08:00
Björn Lindqvist f5dc4afb2e VM: better error message in case factor_vm::store_external_address fails 2015-01-28 14:58:22 +00:00
Björn Lindqvist 434e4ef4b7 VM: fix the debug printing so that instead of always printing to std::cout, you supply the stream to print to 2015-01-28 14:58:21 +00:00
Björn Lindqvist d18c48c75b VM: possible fix for #1265. the size of the stack frame appears to have been miscalculated in iterate_callstack which this commit fixes. 2015-01-15 09:29:14 +00:00
Björn Lindqvist ee5fd49b9e VM: simplified fixup_gc_workhorse::fixup_data by mering lots of functions only used once 2015-01-15 09:29:14 +00:00
Björn Lindqvist 8ea1eea4e1 VM: instead of passing around the trace_contexts_p arg, just clear the contexts in primitive_save_image_and_exit() it has the same effect but is simpler 2015-01-15 09:29:14 +00:00
Björn Lindqvist 4d7bc4c169 VM: merge of slot_visitor and code_block_visitor
Looks like there is no reason for them to be separate classes and by
merging them you can simplify lots of code.
2015-01-15 09:29:14 +00:00
Björn Lindqvist d2aea0f606 VM: replaced the reset_generation() generic method with one method for each generation 2015-01-15 09:29:14 +00:00
Björn Lindqvist dc9e937beb VM: vm::iterate_active_callstacks is only used once, so it's simpler if the code body is "inline" 2015-01-15 09:29:14 +00:00
Björn Lindqvist b61eaa8a16 VM: the full_collector class isn't needed since it is only used once 2015-01-15 09:29:14 +00:00
Björn Lindqvist 693e8ad33a VM: the clear_mark_bits methods are only called once -- make the calls inline instead 2015-01-15 09:29:14 +00:00
Björn Lindqvist fb9fa12cdd VM: change the definition of entry_point in word and quotation from void* to cell
this gets rid of lots of redundant casts from void* to cell
2015-01-15 09:29:13 +00:00
Björn Lindqvist f0bf693beb VM: free_list_allocator::first_block, last_block and next_block_after can be refactored away 2015-01-15 09:29:13 +00:00
Björn Lindqvist 1beac119d8 VM: removes the template parameter from mark_bits
since mark_bits only deals with arithmetic on memory addresses, it
doesn't need to be specialized so it can be untemplateized
2015-01-15 09:29:13 +00:00
Björn Lindqvist af270cb4d8 VM converts the methods callstack::frame_top_at and code_block::offset to use cells instead of void*'s 2015-01-15 09:29:13 +00:00
Björn Lindqvist 615420fe61 VM: calls to visit_code_roots() replaced with visit_uninitialized_code_blocks() 2015-01-15 09:29:13 +00:00
Björn Lindqvist eb7a5ab1ba VM: some more fixing to make the types match better, converting void* to cell 2015-01-15 09:29:13 +00:00
Björn Lindqvist e47181e87a VM: change type of callstack_top and callstack_bottom from void* to cell
cell and void* is always the same size, but now you can remove lots of
redundant type casts from void* to cell.
2015-01-15 09:29:13 +00:00
Björn Lindqvist a6e191a490 VM: the frame_return_address and set_frame_return_address functions aren't needed (clearer to read/write the pointers directly) 2015-01-15 09:29:13 +00:00
Björn Lindqvist 11e906139b VM: code_block::scan, make it so the method always returns -1 if scan can't be determined, part of the fix for #1265 2015-01-15 09:29:13 +00:00
Björn Lindqvist 8ee1f890f2 VM: refactoring intended to remove trace_*-methods that are just
simple delegations to the data/code_visitor instances
2015-01-15 09:29:12 +00:00
John Benediktsson 025283f252 vm: store full command-line including executable first argument. 2014-12-22 22:39:52 -08:00
John Benediktsson 70778b89ae Revert "VM: always clear the data and retainstack in general_error because they might contain uninitialized values (#1187)"
This reverts commit 378f208025.
2014-12-04 11:46:28 -08:00
Doug Coleman 875d2421df vm: We don't want ambiguity for which print triggered on a gc error. Differentiate the error messages. 2014-12-04 10:35:32 -08:00
Björn Lindqvist 378f208025 VM: always clear the data and retainstack in general_error because they might contain uninitialized values (#1187) 2014-12-04 10:26:23 -08:00
Björn Lindqvist 1cec8a7814 VM: modifying the uninitialized_blocks map in place instead of creating a new one is more efficient 2014-12-04 10:23:34 -08:00
Björn Lindqvist 451fc12411 VM: redundant if, trace_cards() doesnt do anything for empty generations anyway 2014-12-04 10:23:33 -08:00
Björn Lindqvist 93134b949f VM: the aging_collector and nursery_collector classes aren't needed because they are just simple instatiations of copying_collector 2014-12-04 10:23:33 -08:00
Björn Lindqvist 423e983514 VM: refactoring to get rid of the megamorphic_call_stub and check_code_pointer() words 2014-12-04 10:23:33 -08:00
Björn Lindqvist 885b5c7043 VM: no need for a nursery_space class, it's just a bump_allocator 2014-12-04 10:23:33 -08:00
John Benediktsson 4837ceebb4 vm: fix OS X issue with using symlinks from outside $factor. 2014-12-03 19:19:52 -08:00
Doug Coleman c675694619 vm: Annotate more places where we can gc.
Code formatting fix.
2014-11-29 19:25:46 -06:00
Björn Lindqvist 231f50039b VM: move next_object_after() and first_object() to aging_space (no iteration possible in nursery) 2014-11-21 02:16:04 -08:00
Björn Lindqvist 50c74fc496 VM: get rid of the duplicated nursery instance in vm->data->nursery
vm.nursery and vm->data->nursery are different objects. They get out
of sync when Factor code bumps vm.nursery but leaves vm->data->nursery
unchanged. The emptiness of vm->data->nursery meant that each_object()
never iterated it.
2014-11-21 02:16:03 -08:00
Björn Lindqvist 2a5e1e06f3 VM: each_object() can't iterate the nursery so instead we assume it's empty 2014-11-21 02:16:03 -08:00