Commit Graph

171 Commits

Author SHA1 Message Date
Torsten Ruger
4ff84133d2 add append to MomCompiler
also lazy init boot_function, so that compilers can be added up
before going to translate, where the boot_compilers are used
2018-11-02 15:54:30 -07:00
Torsten Ruger
f798173a09 change to_risc and builtin code according to last commit
Wherever space was loaded to get to the next_message
we now load the Message factory.
Otherwise much the same, only the attribute is next_object, not next_message
The binary is growing with 1k objects per factory, so i had to fix (hack) arm to handle bigger constants
close #14
2018-09-01 11:28:53 +03:00
Torsten Ruger
0a390cc5a9 shaves an instruction off resolve_method
by loading nil directly,  not space first
2018-09-01 11:20:59 +03:00
Torsten Ruger
dc12c1d70b add the addresses from labels as constants 2018-08-29 21:06:29 +03:00
Torsten Ruger
71ab369c71 use factory to generte intergers in space
start with just integer factory in space
change all the hand-out code
still #14
2018-08-24 18:49:21 +03:00
Torsten Ruger
9687d6611f avoid adding risc instructions twice
that causes loops in the chain
infinite loops in the code that are hard to debug
closes #11
2018-08-19 17:29:04 +03:00
Torsten Ruger
f85fe8a2cb fix bug in slot_load and definition
move parfait helper for reuse
2018-08-19 15:36:51 +03:00
Torsten Ruger
253d2fead8 change all to_risc functions to add directly
still #11
test not working yet
2018-08-19 13:18:25 +03:00
Torsten Ruger
b294208025 continue with #11
slots are the most tricky, especially testing
2018-08-19 13:06:00 +03:00
Torsten Ruger
047a36178f start with #11
by adding striaght to compiler
2018-08-19 12:56:44 +03:00
Torsten Ruger
176b12d896 last two to_risc converted to builder
no change of tests, good sign
2018-08-16 20:28:42 +03:00
Torsten Ruger
da9dc30c20 move dynamic_call to builder
no change of test, great
also remove some duplicate code that was hanging around in method_compiler
2018-08-16 10:43:41 +03:00
Torsten Ruger
ce157ffa94 change block_yield to_risc to use builder
only changes the order of two instructions
2018-08-16 08:58:49 +03:00
Torsten Ruger
1dabe0fda1 finish the idea behind #8, conditionally creating variables
by using space? , the ? makes for conditional creation of the variable
This is especially useful for constants (ie space)
2018-08-15 19:59:17 +03:00
Torsten Ruger
37461a1727 add the ! syntax to create variables in builder, fix #8
now a variable has to be created before being used
thus it is save to develop contracts where a certain name
must exist in the scope
Maybe the syntax starts getting a bit weird, but at least the ! is a common symbol in ruby
2018-08-14 19:39:46 +03:00
Torsten Ruger
25d7b8bd83 chaning calling convention not to add frame/arg types
these types are only needed to debug and can be gotten from the method (also in the mesage)
just saving the 6 instructions for every call
This was made possible through previous commits on fake_memory access
2018-08-12 14:47:05 +03:00
Torsten Ruger
3d113b4d83 fix more of the changed names
add a few self.
2018-08-12 13:10:44 +03:00
Torsten Ruger
393ac873c9 change return sequence to return messages to space
as it was before blocks
(thought blocks would make reuse of messages impossible, but was wrong, this only appilies to lambdas)
(too) many tests affected
2018-08-06 14:07:17 +03:00
Torsten Ruger
fd25f997ce reqrote return sequence with builder
added test _before_ , same code, just much easier to read
in preparation for returning messages
2018-08-06 13:04:47 +03:00
Torsten Ruger
595e032edf add function_return helper to risc_value
create a function_return from within builder
2018-08-06 13:03:33 +03:00
Torsten Ruger
4d4b691a4b adds a return jump
that will be used to jump to the return sequence
2018-08-02 17:34:44 +03:00
Torsten Ruger
9c6a099cde block test
working on return semanitcs
(still avoiding the implicit return)
2018-07-30 14:10:24 +03:00
Torsten Ruger
a3059108eb compile the blocks too
method_compilers have block_compilers just like
methods have blocks
But assemblers are a flat list
2018-07-30 10:27:32 +03:00
Torsten Ruger
4839e0d245 minor naming and spaces 2018-07-27 10:46:22 +03:00
Torsten Ruger
f5c284b3a0 bring the blocks down to mom level
reusing message_setup, but adding yield specific instructions
2018-07-24 11:35:49 +03:00
Torsten Ruger
d80ef4bf4e store method, not name, in message
changes the calling and thus too many test
2018-07-22 22:29:32 +03:00
Torsten Ruger
4cc04787e9 remove Risc.resolve_to_index
mostly by using better typed registers,
which cleans up the code where it was used
2018-07-16 19:00:04 +03:00
Torsten Ruger
3bc85805a4 must pass registers to slot_to_reg and reg_to_slot
as they are typed, those functions don't resolve on Risc, but the register type
miscother changes from previous commits
2018-07-15 16:30:50 +03:00
Torsten Ruger
a71a6d34fb use message reg not message
for upcoming change
2018-07-15 15:14:38 +03:00
Torsten Ruger
ab8b574e9c also recode the slot_definition resolution
much like in the slot_load. In fact suspiciously so.
wip, as also changing to storing type (not sym) in reg
2018-07-14 22:39:00 +03:00
Torsten Ruger
58c7294abd finish the loop in slot_load
thus rewrite of that old nested if thing is done
2018-07-14 11:04:21 +03:00
Torsten Ruger
61c840c023 start to move slot_load code to register_value
the iea is to iterate through register_values while reducing the slot_load to a number of Slot_to_regs
wip
2018-07-13 21:56:55 +03:00
Torsten Ruger
a095515b0e new get_type_by_class_name helper for space
sorely needed, with 36 occurences replaced
2018-07-13 21:50:40 +03:00
Torsten Ruger
edea9ac080 makeing the method of the compiler more or less private
in preparation for using the same code for bocks
2018-07-09 19:32:17 +03:00
Torsten Ruger
dd544214b3 start with block_compiler
as a copy of method_compiler
re-merge later, when we know what's needed
2018-07-09 16:48:23 +03:00
Torsten Ruger
9005513368 rename typed_method to callable_method
seems to make the essence clearer
also extracted base class
2018-07-07 09:11:09 +03:00
Torsten Ruger
d8b58d8da6 fix inital main (again)
stop even compiling a fake main if a real exists (in builtin)
previous version was still buggy: using builting methods types (especially locals) even comiled version had different
2018-07-04 09:17:30 +03:00
Torsten Ruger
6f936f190d misc to_s and small fixes 2018-07-04 08:28:29 +03:00
Torsten Ruger
8b9fd29ce9 Only add Builtin methods that are not in the current compilation
Current bug looks like the original main is used in parts
(not the compiled one, but the builtin on)
2018-07-04 08:28:05 +03:00
Torsten Ruger
e099014d63 fix dunamic jump in interpreter and misc 2018-07-03 19:15:36 +03:00
Torsten Ruger
bb1d1495db fix constant propagation through the layers
so they can end up in the binary
2018-07-03 10:12:22 +03:00
Torsten Ruger
63dfee0978 move some tests around (and fix them) 2018-07-02 23:20:54 +03:00
Torsten Ruger
9bd8eab999 remove class attribute that was left dangling
not used, which prompted rename. just forgot to delete it
2018-07-02 15:50:54 +03:00
Torsten Ruger
1132309f6a unify space collection attribute naming
currently space is still acting as a sort of memory manager.
For proper linking, all objects must be reachable from space, hence the plural versions like messages and addresses (even they are instances, it is the list that is important)
To dish out instance to use, the head must be kept, ie next_XXX for intergers, return addresses and messages
2018-07-02 15:49:51 +03:00
Torsten Ruger
22408b86c6 return the linker from mom_compiler
linker holds assemblers
assemblers come from method compilation
and so the layers come into focus
2018-07-01 21:51:48 +03:00
Torsten Ruger
bb49f1be78 rename ClassCompiler to MomComplier
ended up not even using the class, it just came from there
It actually compiles methods, and it turns out is the point where builtin comes into the picture as it's boot process also returns method compilers
2018-07-01 21:26:45 +03:00
Torsten Ruger
e75aef933d have to pass constants around now
as they are not global anymore
2018-07-01 14:11:29 +03:00
Torsten Ruger
f7dfa1c45e return assemblers from translation
result of translate is cpu instructions, our equivalent of assembly.
So return Assemblers for next stage
2018-07-01 11:56:09 +03:00
Torsten Ruger
05669065ca back to method_compiler
it is what it is
2018-06-30 23:26:28 +03:00
Torsten Ruger
208b98d709 start to move translate code 2018-06-30 22:53:32 +03:00