Commit Graph

1678 Commits

Author SHA1 Message Date
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
5b2c7745fe move the methods test to mains
previous commit made the mains tests more general
this joins methods tests here
so we can run them on arm too
fix #11
2018-08-18 20:06:15 +03:00
Torsten Ruger
80264c5322 mains tests can include any code
not wrapping as main anymore
(must still include mains)
first part of #11
2018-08-18 19:42:14 +03:00
Torsten Ruger
233b83510f fixed some disabled tests 2018-08-17 22:43:17 +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
252ae6de72 finally get rid of the fixme in div10
create (load/reduce) the int once and transfer.
Save a cruicial 2 instructions

Also expanded the variable name possibilities with _self, __const , _1 and _2
2018-08-15 18:18:21 +03:00
Torsten Ruger
15337e10be move putstring to use builder 2018-08-15 17:52:21 +03:00
Torsten Ruger
e953cc90d5 remove some more add_xx functions
also load labels by dsl now
2018-08-14 20:24:48 +03:00
Torsten Ruger
520dc7b41f remove ad_transfer in save_message
towards removing all add_
change to set_builder and chaining in reg values
2018-08-14 20:08:58 +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
fb54d68020 redo restore after syscall with builder 2018-08-13 18:48:54 +03:00
Torsten Ruger
55bc9c5273 rewrite new_int with builder 2018-08-13 18:02:34 +03:00
Torsten Ruger
86462e238a large test changes due to change in cc
calling convention does affect
less than before, but still a LOT
2018-08-12 15:02:23 +03:00
Torsten Ruger
fee9e261a5 still some names that needed changing 2018-08-12 14:48:20 +03:00
Torsten Ruger
28b4a2b373 add line numbers to array output 2018-08-12 13:58:58 +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
84de400529 some test change because of renaming
next is a keyword, can't be used as instance writer
fake_memory gets the pobject for debug
2018-08-11 19:17:20 +03:00
Torsten Ruger
99a95d40a6 also redid the get/set internal byte with builder
had to pimp register value to use a semblance of the dsl
using <= for bytes and << for words
2018-08-09 20:16:55 +03:00
Torsten Ruger
0d52b620ed redid integer comparison with builder
had to add some helpers to builder
2018-08-08 20:53:06 +03:00
Torsten Ruger
fc6aa4e28b rework operator with builder 2018-08-08 15:49:47 +03:00
Torsten Ruger
78466090b3 add reduce_int and fix bug
hardcoded operator, buh
reduce_int to avoid that long constant
2018-08-08 15:49:07 +03:00
Torsten Ruger
f5ea51c4d0 new test to run out of ints 2018-08-08 12:03:17 +03:00
Torsten Ruger
6200a35562 add shortcut for class_name
for when type is not set
2018-08-08 12:02:59 +03:00
Torsten Ruger
c63e55c2bc add an operator function
to be able to use the builder more
also add ability to load fixnums (for the int functions)
2018-08-07 20:48:36 +03:00
Torsten Ruger
554c2d3d73 just checking fibo 30
at just under 8000 instructions i can't wait to run real benchmarks
2018-08-06 14:13:39 +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
77cbc0ad6a always use fail fast (in dev)
but not for the travis run (or test_all check)
2018-08-06 13:07:06 +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
c9d8f750e5 extend type inference for dsl
and finally test it
2018-08-06 10:11:12 +03:00
Torsten Ruger
308996bf8e fix all tests accordingly to new return 2018-08-02 17:37:27 +03:00
Torsten Ruger
050659ea12 block tests for if and while
bundle update too
2018-08-01 20:17:41 +03:00
Torsten Ruger
4f3c0d8b08 more block tests working
dynamic calls and operators on block args
(giant strides)
2018-08-01 16:31:16 +03:00
Torsten Ruger
4b4528abb2 propagate constants from block_compiler up
up to method_compiler, where they are collected by mom_compiler
(and included in binary)
2018-08-01 16:27:34 +03:00
Torsten Ruger
81cc109d1e more block tests
instance and arg access
2018-07-31 19:44:40 +03:00
Torsten Ruger
04bcfea8ce fix scoping of blockcompiler
Was accessing caller scope, but must use caller's caller as the yield itself is a call.
2018-07-31 18:00:42 +03:00
Torsten Ruger
4fe0edd1e3 first risc level block test working
assign was not executing yield
baecause it was just testing for send, instead of callable
2018-07-30 20:11:52 +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
165036ea39 misc 2018-07-30 10:26:47 +03:00
Torsten Ruger
285a88b59f generalize assemblers to use callables
not just methods,  they are almost the same anyway
2018-07-30 10:23:42 +03:00
Torsten Ruger
4055709529 push the name down into callable
blocks need a name too
if just for debug, and stacks
2018-07-30 10:21:43 +03:00
Torsten Ruger
1cb07a4164 block arg access was off by one 2018-07-27 12:16:06 +03:00
Torsten Ruger
e1d5592c55 fix boot to include blocks correctly 2018-07-27 10:48:45 +03:00
Torsten Ruger
4839e0d245 minor naming and spaces 2018-07-27 10:46:22 +03:00
Torsten Ruger
700744e6d5 block assignment ruby to vool 2018-07-25 11:06:42 +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
b6c85cd4a4 callable as base for yield and send
more yield tests
2018-07-21 14:34:39 +03:00
Torsten Ruger
84a6fb1aba more block tests 2018-07-21 12:51:20 +03:00
Torsten Ruger
f620f0fd74 last test fixed, ruby layer complete 2018-07-20 21:27:55 +03:00
Torsten Ruger
b00b0cf064 fixed some interpreter tests
hoisting is slightly more simple and that adds a couple insstructions
2018-07-20 21:00:47 +03:00
Torsten Ruger
6022aa4dab introduce ruby variable and remove ct_type
cleaner oo
2018-07-20 20:53:35 +03:00
Torsten Ruger
9548440949 remove old tests
those normalisation tests are now to_vool tests
2018-07-20 20:10:12 +03:00
Torsten Ruger
235853ab2d first run at ruby block to_vool
leaving the parser structure in the ruby layer,
but adopting the constant approach in vool
2018-07-20 20:07:15 +03:00
Torsten Ruger
0238874c20 fx ruby send args 2018-07-20 20:06:14 +03:00
Torsten Ruger
172327f045 fix assignments
which was letting ruby instances through
also rename the doubious copy
2018-07-20 18:13:58 +03:00
Torsten Ruger
6a58a71c0a fix while.to_vool
sanitize normalizer on the way
- return ruby, let caller to_vool
- return single statement, not single? statements
2018-07-20 17:51:17 +03:00
Torsten Ruger
9b8bd57db4 fix if to_vool
and add (simple) hoisting tests
2018-07-20 17:30:08 +03:00
Torsten Ruger
98788b52d3 fix ruby variables 2018-07-20 14:22:26 +03:00
Torsten Ruger
f4402ba30f fix local assignment
was missing a method that got lost in copy/paste
also renaming to get guard to pick up tests
2018-07-20 14:16:29 +03:00
Torsten Ruger
d14eca3e70 fix assignments to_vool 2018-07-20 13:43:37 +03:00
Torsten Ruger
e536a7ac88 fixing send to_vool
was hoisting unneccessarily, because not respecting basics
2018-07-20 13:15:16 +03:00
Torsten Ruger
7b02feae7a fix ruby send statement
remove ruby expression
2018-07-20 10:05:11 +03:00
Torsten Ruger
8cd9818f64 fix ruby return statement
assignment and normalizer on the way
2018-07-20 09:07:09 +03:00
Torsten Ruger
a5168ef818 fix ruby class statement 2018-07-19 21:44:48 +03:00
Torsten Ruger
238f09b5ad fix method to_vool 2018-07-19 21:36:28 +03:00
Torsten Ruger
7b4a0126f7 add a helper to get the vool equivalent of a ruby class 2018-07-19 20:59:15 +03:00
Torsten Ruger
77be0d3f73 fixing the ruby creation tests 2018-07-19 16:30:36 +03:00
Torsten Ruger
f728725b1a change the ruby block to be like the ruby block
ie modelled like the ast outputs it
2018-07-19 16:22:44 +03:00
Torsten Ruger
61225c2f20 ifx most of the conversion
well . . it's still converting to ruby, minor detail
2018-07-19 14:59:10 +03:00
Torsten Ruger
38350dd198 start a new ruby layer to do the to_vool conversion
the "normalization" is getting more and more complicated and is not tested
And it seems i really don't like working with the untyped ast
2018-07-19 14:46:51 +03:00
Torsten Ruger
f624e38dbb finish assign test
start ifs
2018-07-18 13:57:38 +03:00
Torsten Ruger
3c1137066b more block tests reveal a compiler bug
copy/paste, args twice in switch
2018-07-18 10:13:19 +03:00
Torsten Ruger
ff8b95f21a get block resolution to use the extra
block_compiler puts in the extra, that we get out when resolving the type
Thus block args work, though only by assuming direct call
2018-07-17 10:37:33 +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
3343017dba move type resolution to compiler
from risc_value.
also unite mock compilers
2018-07-16 11:46:18 +03:00
Torsten Ruger
e3673e579c pass extra info into register init, not just value
extra info may be hash, maybe just type info
2018-07-16 11:23:09 +03:00
Torsten Ruger
b410538d07 uups, forgot to check that in 2018-07-15 17:44:26 +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
f31d22d901 use real type in register, not symbol
this has some more consequences, upcoming
2018-07-15 15:16:12 +03:00
Torsten Ruger
69385c863f some more addresses 2018-07-15 15:13:25 +03:00
Torsten Ruger
eaeea29e38 helper erro handling 2018-07-15 12:32:02 +03:00
Torsten Ruger
648ec772ec direct index access helper for type 2018-07-15 12:30:50 +03:00
Torsten Ruger
581f457119 type helper for class name 2018-07-14 11:03:16 +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
21009b0e9b delegate resolve to compiler when needed
and forgotten space test
2018-07-13 21:55:27 +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
27a142f2a3 use compiler base class for blocks too
can now go to mom level and add
test harness still looks overly complicated, but works
first block tests at mom level
2018-07-10 22:03:32 +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
63b55f2aa4 refactor a bit for upcoming delegations
must get method to be private
more tell, not ask
2018-07-09 18:16:51 +03:00
Torsten Ruger
06e78a7326 fix locals scope in method and blocks
methods used to gobble up any locals of included scope. fixed
Blocks now create frame_type correctly and don't include and locals that are in fact method scope
2018-07-09 17:55:45 +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
7231f301ba move tests with mom_compile to mom 2018-07-07 22:45:48 +03:00
Torsten Ruger
0d900de695 block creation and insertion with correct types 2018-07-07 22:42:00 +03:00
Torsten Ruger
1913848910 fix conflicting test class names
why the fail didn't show locall, even with the same seed, i do not know
2018-07-07 17:57:46 +03:00
Torsten Ruger
f2af763f14 update readme 2018-07-07 17:34:08 +03:00
Torsten Ruger
2f07cc34f3 add parfait block 2018-07-07 15:50:43 +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
acd5cd8f30 rename for_type to self_type
and split a base class off TypedMethod
2018-07-06 20:01:17 +03:00
Torsten Ruger
3f80953385 passing compiler to to_mom, not method
To be able to delegate scope (block/method) things later
2018-07-05 14:02:38 +03:00
Torsten Ruger
16d91f24ce start to test block_statement 2018-07-04 23:21:11 +03:00
Torsten Ruger
2485f7e9eb misc fixes and (finally, sigh) green again
deeeep dive, almost 40 commits
2018-07-04 09:18:55 +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
cab6bc389f misc little test fixes 2018-07-03 10:12:40 +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
55b5884c4e minor test fixes 2018-07-02 23:03:33 +03:00
Torsten Ruger
56f2742e89 fix code listener logic bug
next's position was only updated initially
previous logic relied on pushing everything long rightly
but it wasn't right, and no harm in setting position twice,
as events only fire if there is real change
2018-07-02 23:03:00 +03:00
Torsten Ruger
a1197fb70c interpreter tests working again 2018-07-02 17:29:26 +03:00
Torsten Ruger
4b33d1c056 fix many a test especially whole mom
but some positioning bug still in there preventing
binary to work
2018-07-02 17:01:07 +03:00
Torsten Ruger
474cd4b348 linker and collector test work again
had to give space a fixed number of addresses
2018-07-02 16:19:01 +03:00
Torsten Ruger
4e49c0469c fix compiling support
which makes all the vool tests pass again
2018-07-02 15:52:51 +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
07a154be70 code listener now get platform explicitly
used to grab it from global machine.
Now passed in from linker
tests fixed accordingly
2018-07-02 09:39:07 +03:00
Torsten Ruger
8952b39446 linker goes through assemblers, not space
used to traverse all methods in space
now "just" use the passed assemblers, which usually should be compiled and builtin (but for testing . . .)
tests fixed accordingly
2018-07-02 09:37:58 +03:00
Torsten Ruger
f4b1290e58 position tests working 2018-07-02 09:35:57 +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
5f2a256608 fix platform derivation and some tests 2018-07-01 21:27:27 +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
c947c27a14 clean up booting
many machine boot became obsolete
or just neede parfait to boot
actual linker functionality pending
2018-07-01 14:12:42 +03:00
Torsten Ruger
e10092a4be rename machine to linker
even work is not quite finished, but helps root out offenders
(needless to say this is wip, deep red wip)
2018-07-01 13:45:14 +03:00
Torsten Ruger
57fc67ddf6 move address list to object_space
where i guess it should have been from the start
2018-07-01 13:43:53 +03:00
Torsten Ruger
35b10c46a3 adds the risc instructions to the compiler
since they are not in the method anymore
2018-07-01 11:59:52 +03:00
Torsten Ruger
22b1fea587 use rubyc_compiler as instance
not as before class methods
so we can carry the state around
2018-07-01 11:59:07 +03:00
Torsten Ruger
1505df894a remove translation
from machine, which is quickly becoming a linker
2018-07-01 11:58:06 +03:00
Torsten Ruger
05669065ca back to method_compiler
it is what it is
2018-06-30 23:26:28 +03:00
Torsten Ruger
91a99b1239 let boot_functions return the compilers
methods are still added, but this is a good step to removing the risc/cpu level from the methods
2018-06-30 23:16:17 +03:00
Torsten Ruger
208b98d709 start to move translate code 2018-06-30 22:53:32 +03:00
Torsten Ruger
daf1b56062 start on class compiler
idea is to get cleaner layer seperation
reduce machine and rework builtin boot
2018-06-30 19:20:17 +03:00
Torsten Ruger
4a7cc72732 always list of methods in class
improve vool test dirs
2018-06-30 10:08:18 +03:00
Torsten Ruger
46d8f5002f hoist parfait boot out of the machine boot 2018-06-30 00:39:23 +03:00
Torsten Ruger
8d7a2fe4d6 fix mom tests
and always have a list inside a class
2018-06-29 23:29:10 +03:00
Torsten Ruger
5b87133df2 split rubyx tests
in vool and mom level
2018-06-29 23:04:50 +03:00
Torsten Ruger
7006c8e3aa fix remaining tests
rename ripples
2018-06-29 22:56:49 +03:00
Torsten Ruger
c8451d0048 create rubyx dir and move previous vool_compiler there 2018-06-29 22:46:39 +03:00
Torsten Ruger
7377522417 fix test ripples and minor parfait naming
Parfait ruby and boot names desynced, fixed that
2018-06-29 21:03:06 +03:00
Torsten Ruger
ae35fed0ab fix list to expand
prevously fixed max length list
now expanding on demand, using next
quite like binary_code, a pattern is emerging
2018-06-29 20:58:59 +03:00
Torsten Ruger
5036dd68df remove to_mom from ruby_to_vool
must have slipped in
affects mosty tests
2018-06-29 14:57:48 +03:00
Torsten Ruger
6bd01fd55f rename method_compiler
in line with other compiler XX_Compiler being the compiler for that layer
remove type from compiler as it is in method available
2018-06-29 14:48:52 +03:00
Torsten Ruger
e6f01748ff move adapter stuff around 2018-06-29 14:26:25 +03:00
Torsten Ruger
86b1edb40c add seperate builders
remove if with polymorphism for different builders
(easier to understand by naming)
2018-06-29 13:27:57 +03:00
Torsten Ruger
3dffebed3f rename a bit 2018-06-29 13:03:19 +03:00
Torsten Ruger
d50893bb0f rename risc_value to register_value
almost to register, but it still carries that value
2018-06-29 11:39:07 +03:00
Torsten Ruger
606c7bf906 remove booted flag
just boot if needed
2018-06-29 11:36:14 +03:00
Torsten Ruger
18994d2b4b start on yield statement 2018-06-28 20:15:24 +03:00
Torsten Ruger
f0ba863721 remove to_mom / create_objects dichotomy
wsa supposed to be clearer, but even to me seems confusing now.
2018-06-26 20:46:58 +03:00
Torsten Ruger
c6a903073a start on blocks 2018-06-26 20:28:27 +03:00
Torsten Ruger
4103da7490 small test fixes 2018-06-25 20:21:15 +03:00
Torsten Ruger
67a6ef9f67 add rewriting of operator assignment
foo += 1 becomes foo = foo + 1 in vool
2018-06-25 16:32:20 +03:00
Torsten Ruger
70d7e654c4 only check object file creation in efl
remote execution only per request
2018-06-25 00:39:13 +03:00
Torsten Ruger
b804be5f70 fix dynamic call
which had the method in the regsiter, not the binary.
Single SlotToReg added (and some tests)
Which amazingly fixed all broken binary tests
2018-06-25 00:19:43 +03:00
Torsten Ruger
068bda492c implement DynamicJump for Arm
which is in fact the same as return (moving address into pc)
2018-06-24 19:13:55 +03:00
Torsten Ruger
f83f52faa0 reusing ssh instance for arm
some speedup , but hoped for more
2018-06-24 17:44:02 +03:00
Torsten Ruger
c8a903cd83 adds arm testing of same files 2018-06-24 17:10:39 +03:00
Torsten Ruger
ae976c8fb9 generate mains test methods according to file name 2018-06-24 16:48:23 +03:00
Torsten Ruger
8d369dbfa1 automate mains test more
move sources and include exit code and stdout in filename
2018-06-24 13:37:36 +03:00
Torsten Ruger
563ed4647a extract the ruby from mains tests
move up in directory
in preparation for arm tests
2018-06-24 11:56:10 +03:00
Torsten Ruger
87be6bf9d5 add automated arm tests 2018-06-23 15:58:43 +03:00
Torsten Ruger
ce79617875 fix the exit sequence
was returning wrong register (1, not 0)
also saving the message for test, which changes order as the return value destroys the message
2018-06-19 19:52:06 +03:00
Torsten Ruger
5f7683efcf pass return integer back out through exit
for testing of binaries later (and off course general correctness)
Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
2018-06-19 18:55:47 +03:00
Torsten Ruger
db459fcd3d fix label loading in arm
was still loading the integer address
instead of the return address's address
Hello World working
2018-06-19 17:35:00 +03:00
Torsten Ruger
956c2ebe54 make arm use branch_lsteners 2018-06-19 10:51:03 +03:00
Torsten Ruger
046617f8dc add branch listener functionaliy
have to store the branches and loop again as labels
dont neccessarily have positions yet
2018-06-17 22:25:38 +03:00
Torsten Ruger
3298651238 split create_binary into two phases
Which gives instructions a chance to check everything
and in Arms case check the constant loads/ instruction adding
So that during assembly no more change happens (and we don't have to reassemble)
2018-06-17 13:53:17 +03:00
Torsten Ruger
c94f6eaa78 small maintanance 2018-06-16 21:01:15 +03:00
Torsten Ruger
7543236f4f objects didn't get positions
positions.empty? was wrong check
2018-06-16 10:58:54 +03:00
Torsten Ruger
698c845297 seperate position create and register
many test fixes
2018-06-15 22:00:49 +03:00
Torsten Ruger
9c93b38b8f crete positions while collecting objects
clear two phase lifecycle for positions
always created invalid and set later
new does not auto add to cache
but create and get_or_create do
2018-06-15 21:54:21 +03:00
Torsten Ruger
2c765c8f14 rename the objects accessor
and move to object keys, not object_id
2018-06-15 09:18:39 +03:00
Torsten Ruger
3cc9175efa start BranchListener
but on hold, since it needs positions before we have them
Must create them during collection phase
2018-06-14 21:29:34 +03:00
Torsten Ruger
eaaf61c117 fix position test 2018-06-14 21:19:22 +03:00
Torsten Ruger
5ec235d049 fixes outstanding misc, All green
Well. it's been a while, positioning is fixed (again)
apart from the upcoming BranchListener
2018-06-10 13:19:55 +03:00
Torsten Ruger
e1683938ed fix label positioning bug
where a label at the end of a binary code resulted in the
label actually taking up a position, instead of sharing it with it's next
2018-06-10 13:18:56 +03:00
Torsten Ruger
0513cd504f update return address in label
so return jumps go to the right address
2018-06-10 09:15:57 +03:00
Torsten Ruger
c7ad1d98ca introduce the LabeListener to move instructions along when first code position changes 2018-06-09 22:13:43 +03:00
Torsten Ruger
ec1d38f5a6 reimplement instruction listeners with indexes
easier to understand, as indexes map to Binarycode indexes, and can thus later be used to assemble directoy into the  code
Almost no change in tests (now only multiples of 4 addresses allowed)
2018-06-09 17:41:39 +03:00
Torsten Ruger
cf94227b2c fix code init bug
where initial pos wasnt propagated
2018-06-09 09:16:23 +03:00
Torsten Ruger
ad3040a846 add position_chaning to event interface
by reacting to the change _before it happens, we can move any BinaryCode out of the way

So when Instruction are inserted and code gets inserted, we don't need to set up the correct listener explicitly (which is tricky across mathods and changing chains), but instead just move anything that is in the way along
2018-06-09 08:10:41 +03:00
Torsten Ruger
74c15d45a3 some more mocking worked
some didnt
2018-06-08 20:43:36 +03:00
Torsten Ruger
5815d32bde make the instructions jump over the BinaryCode end 2018-06-07 19:27:44 +03:00
Torsten Ruger
2d218bbc48 work on jump insertion continues
Now registering CodeListener instead of PositionListener
Also instead of on the previous, in itself, which is simpler
and allows to react to insertion at end
2018-06-07 19:26:02 +03:00
Torsten Ruger
7fa8397b56 insertion pushes, split position tests 2018-06-06 10:19:18 +03:00
Torsten Ruger
c22aff4c4f start on insertion events and handling 2018-06-06 10:00:07 +03:00
Torsten Ruger
4789b63fcb fix the gapping of instructions
so last binary stays empty and new starts at 8
2018-06-06 01:16:00 +03:00
Torsten Ruger
4ab6d62acf small arm fixes etc 2018-06-06 00:53:41 +03:00
Torsten Ruger
d7b3368b28 fix some pesty errors
need to fix instruction overlap beofre interpreter starts again
2018-06-05 19:05:12 +03:00
Torsten Ruger
8d953a619f propagate instruction positions
still overlapping onto binaries, but a start
2018-06-05 18:11:25 +03:00
Torsten Ruger
f35ee6425a renaming and test fixing 2018-06-02 23:48:12 +03:00
Torsten Ruger
1d1c7105b4 introduce some helper methods 2018-06-02 23:02:59 +03:00
Torsten Ruger
c2d450f779 fold position module and object position
simpler that way, aslo code is moving to listners
2018-06-02 21:59:41 +03:00
Torsten Ruger
24f6e30b54 start on redoing instruction positions
using insruction listeners (wip)
2018-06-02 21:20:15 +03:00
Torsten Ruger
3bc35c2275 rework binary code positioning setup
dependency chain set up explicitly.
Next have to react to events correctly
2018-06-02 17:29:38 +03:00
Torsten Ruger
91c7903848 start simple with code listner 2018-06-02 16:34:44 +03:00
Torsten Ruger
aa6707337a positioning wip 2018-06-02 16:12:01 +03:00
Torsten Ruger
d1cc482f8f bit of test refactoring 2018-06-01 19:13:53 +03:00
Torsten Ruger
46fbfb7101 adds the simple object dependency
where the next object is dependent on the previous one
and just behind it, the padded_length away
2018-05-31 20:41:04 +03:00
Torsten Ruger
21a9c56ba9 change position event code to use util
general purpose event fireing
can then be used for several event types
2018-05-31 19:05:53 +03:00
Torsten Ruger
2544bc5a85 move position module to folder 2018-05-31 19:01:10 +03:00
Torsten Ruger
49849939a1 little event mechanism for changed positions 2018-05-31 17:01:23 +03:00
Torsten Ruger
0e155315aa movs is not allowed into pc
Illegal instruction it says
Otherwise the status update is nice (for branches) and we’ll keep
2018-05-31 14:03:25 +03:00
Torsten Ruger
67100a3ef8 write adjusted address
and rename integer to address in label
1k hurray
2018-05-31 00:07:58 +03:00
Torsten Ruger
e39e96f646 create return address as own class to hold return addresses
to distinguish from integer, which does not need adjusting
2018-05-30 23:49:01 +03:00
Torsten Ruger
e86ca5ae9d integer was wrong padded§ length
or rather right (2 as should be and will be)
but currently we use next AND value + type means 3, rounded 4
because we can’t swap types at compile time (as is planned at runtime,
we use next OR value)
2018-05-30 14:55:17 +03:00
Torsten Ruger
53107d3ef8 reducing the label's int for return
placing the raw address in the register to jump to
puts the extra instruction at the risc level (not arm), thus changing a
lot of (brittle?) tests
2018-05-30 12:54:40 +03:00
Torsten Ruger
01a2911483 using label int in interpreter 2018-05-30 11:49:29 +03:00
Torsten Ruger
0dc89c772a get the label int to work consistently
still need to use it in the return
2018-05-30 10:54:18 +03:00
Torsten Ruger
074ec34659 wip, fixed some label, need more fixing 2018-05-30 10:29:38 +03:00
Torsten Ruger
c55b41afae sort objects by class before positioning
since we don’t have pages yet, but want consistent layout
2018-05-29 20:52:58 +03:00
Torsten Ruger
e94c9ea37b add failfast
tired of waiting for the almost 1000 tests to run through, just to get
an error message
2018-05-29 20:40:02 +03:00
Torsten Ruger
296617cbaf set label integer to position 2018-05-29 20:30:02 +03:00
Torsten Ruger
8322fca7b3 give labels an integer that will end up being the position at runtime
Since integers are first class objects, we need to use an integer object
as the return address. The actual address can not be stored in an
instance variable since it is not an object.
The address is unique to the label and never changes after positioning
(using the int is next up)
2018-05-29 20:26:00 +03:00
Torsten Ruger
7847420d49 make ints compile time mutable
to change the label value and use the allocated stubs
2018-05-29 17:03:55 +03:00
Torsten Ruger
b81d9565de fix binary code offset when calling
in other words, remember the arm pipeline being 8
2018-05-29 17:03:20 +03:00
Torsten Ruger
4b34546c11 fixing the binary code indexes
AGAIN, that third of all bugs, the off by one
2018-05-28 18:20:09 +03:00
Torsten Ruger
8ef1a471a4 finally change List to derive from data object
can’t derive from data16 as some lists are longer
have to get the delegation to work first
2018-05-28 15:45:29 +03:00
Torsten Ruger
f9a89db10c use fake memory
fix integer offset bug
(which only didn’t cause errors as fixnums are still an order too big
and the famous +1 error hit the empty space)
2018-05-28 15:09:59 +03:00
Torsten Ruger
6c06f61ab8 start on fake memory
get index checks on the array access of parfait
2018-05-28 14:46:26 +03:00
Torsten Ruger
be1bc63ff2 jump was written off the end of binary code, fixed 2018-05-28 11:45:04 +03:00
Torsten Ruger
1c09d4202f fix all test
and thus all green, two weeks of side branch positioning  done
(luckily not on arm, but interpreter)
2018-05-25 20:40:39 +03:00
Torsten Ruger
c0cd1e0740 fix an issue where instruction was in wrong code
embarrassingly used instance variable where it should have been local
2018-05-25 19:16:13 +03:00
Torsten Ruger
6f0fad0957 dragging the extra through resets
as the binary the instruction is in may change when repositioning
2018-05-25 19:04:48 +03:00
Torsten Ruger
8d8cc4b016 more test fixing
only one bug to go
2018-05-24 21:20:56 +03:00
Torsten Ruger
bf23883270 busy fixing tests 2018-05-24 19:38:48 +03:00
Torsten Ruger
183d4152d5 loading label must translate the labels too
(psst: like arm translator already did. duh)
2018-05-24 19:20:06 +03:00
Torsten Ruger
dae8e88b7a recurring bug, don't save label positions
labels are ethereal, no length, so they don’t get to occupy a position
2018-05-24 16:26:56 +03:00
Torsten Ruger
8d510c2e7e getting instruction repositioning right
big bug hunt, involving complicated maths (%)
2018-05-24 14:27:53 +03:00
Torsten Ruger
0293320bb8 use a constant for the binary code offset
where the instructions start
2018-05-23 21:35:22 +03:00
Torsten Ruger
8ca70a6835 Steamline objectPosition init
check for resetting on the same position with different class, which
should not happen
Ie it’s ok for an object to push another object up,
but not for an instruction to land on code
2018-05-23 21:34:49 +03:00
Torsten Ruger
f5d1090c39 no-ops really 2018-05-23 18:06:55 +03:00
Torsten Ruger
a2e7d7c469 give interpreter a clock and pc
where the pc, like in cpu’s is the memory position.
That is what the interpreter works on.
But for humans, the clock is a simpler way to count where the program
is at, no. of instructions executed
2018-05-23 18:05:22 +03:00
Torsten Ruger
ef2dc932ad use positions in interpreter 2018-05-20 15:52:13 +03:00
Torsten Ruger
a7a62d53b2 use modified opal logger
logger was having bizarre format errors
copied and simplified (to get on)
2018-05-20 14:45:48 +03:00
Torsten Ruger
15e4533a2f fix interpreter to use positions
tick from one (simulated memory) position to the next
(not from one instruction to the next)
2018-05-17 20:14:59 +03:00
Torsten Ruger
8966a50a8a getter by position
extract and expand position testing
never return labels (that have the same position as their target)
2018-05-17 20:13:33 +03:00
Torsten Ruger
37d62d298e assemble risc to it's position (not itself)
So in the next step the interpreter can use positions as program counter
and would be much more like the real thing
2018-05-17 09:49:01 +03:00
Torsten Ruger
49c4d170ce make the interpreter platform
but still using the risc_instruction stream
2018-05-17 09:31:36 +03:00
Torsten Ruger
07ed16d765 groundwork for interpreter platform
especially positioning makes the previous interpreter approach to
fragile (too far off the real thing)
Interpreter should be it’s own platform (still use the risc
instructions),
get a translator and use positions
2018-05-16 21:00:14 +03:00
Torsten Ruger
9597fc5756 more slot tests, also in separate files 2018-05-16 12:49:46 +03:00
Torsten Ruger
36e59ebdea some slot load tests 2018-05-16 12:35:44 +03:00
Torsten Ruger
473866e76b start with some slot definition tests 2018-05-15 19:29:27 +03:00
Torsten Ruger
ab4bc370ed another +1 bug 2018-05-15 16:25:55 +03:00
Torsten Ruger
e237bc625a remove unused methods
and a whole lot more index fixes
2018-05-14 20:50:52 +03:00
Torsten Ruger
5d3c70da89 fix type api
tests were using methods that were only used in tests.
2018-05-14 16:13:50 +03:00
Torsten Ruger
3c00239f36 another million index fixes 2018-05-14 15:17:04 +03:00
Torsten Ruger
4a88f342d3 random checkin
still suffering -1 trauma
2018-05-14 12:38:44 +03:00
Torsten Ruger
ab01fa3862 switch to 0 based indexing
the world rocked for a moment (and more fixes to follow)
also the crumbling of idealism was heard
2018-05-14 11:55:01 +03:00
Torsten Ruger
4856b9891d simplify writing binary
loop as should be, fixes the problem (one problem at least)
2018-05-13 18:01:45 +03:00
Torsten Ruger
866467ee5e change binary labels 2018-05-13 17:21:48 +03:00
Torsten Ruger
39902401b9 positioning code by setting first method code
codes will initial (and on reset) propagate the whole chain
2018-05-13 15:28:10 +03:00
Torsten Ruger
7ad36380c2 add next_value for dictionary
also next for list
and add types attributes to space
2018-05-13 13:03:04 +03:00
Torsten Ruger
2d901bf7b6 not wrapping the cpu initial jump anymore
also introduce padding after cpu_init (wip)
2018-05-12 18:36:59 +03:00
Torsten Ruger
232fe67c09 introduce platform to abstract cpu and load address 2018-05-12 18:32:10 +03:00
Torsten Ruger
776a97986d fix instruction positioning
use at as at and only compute difference when needed (to determine if
there is a jump in binary)
Easier to understand that way
2018-05-11 18:36:45 +03:00
Torsten Ruger
bc1e29e4f6 seperate different Position classes into own files
also tests
and have Position module keep all positions
(singletons should be at module, not class level)
2018-05-10 20:56:12 +03:00
Torsten Ruger
1169fa7220 propagating binary code position on extend 2018-05-09 20:36:49 +03:00
Torsten Ruger
6a1528e75a Fix instruction resetting
which happens on insert of a new instruction
2018-05-08 20:53:48 +03:00
Torsten Ruger
7ca7e92dda remove link exception class 2018-05-08 20:22:04 +03:00
Torsten Ruger
cf06642768 start passing positions along inside the position code 2018-05-08 19:59:43 +03:00
Torsten Ruger
ce3cc72f9e move all position setting into position
Position and subclasses handle the logic, external to
the classes, so it can be swapped out later
(at runtime positions can’t change)
2018-05-07 22:30:43 +03:00
Torsten Ruger
68fb9b1bdc rename Position get/set 2018-05-06 20:04:02 +03:00
Torsten Ruger
415df49199 hand context into position 2018-05-06 00:34:59 +03:00
Torsten Ruger
6b7e1e3932 remove link exception raise
need to fix move logic next
2018-05-05 23:55:50 +03:00
Torsten Ruger
40f4bfc287 change to position objects complete 2018-05-05 20:25:10 +03:00
Torsten Ruger
3244c7d633 add position tests
and refactor padding out
2018-05-05 20:11:08 +03:00
Torsten Ruger
d65a982454 start by moving positioned(module) to position(class) 2018-05-05 19:47:18 +03:00
Torsten Ruger
43d5521cfc debugging positions 2018-05-05 19:32:01 +03:00
Torsten Ruger
d49d2665c5 reinit risc_init
fixes over 100 tests :-)
2018-05-01 22:36:46 +03:00
Torsten Ruger
06f51da8f1 rename get_all_methods 2018-05-01 19:19:37 +03:00
Torsten Ruger
1acd231a33 debugging binaries, initial jump issues 2018-04-30 13:28:55 +03:00
Torsten Ruger
d84d208192 implement assignment normalisation
especially when the value is a send that needs normalising
fixes several broken tests
2018-04-27 21:56:41 +03:00
Torsten Ruger
1685ba5a44 fix send normalisation 2018-04-27 21:55:41 +03:00
Torsten Ruger
672ccb351d fix argument hoisting
arguments in vool must be simple variables
finally did the hoisting to do that
2018-04-27 09:59:01 +03:00
Torsten Ruger
08d0aae79e refactor send vool tests 2018-04-26 20:26:42 +03:00
Torsten Ruger
26fe77ed68 add some multi method tests 2018-04-26 12:33:33 +03:00
Torsten Ruger
a8e7602193 extract setup for mains test 2018-04-26 12:33:19 +03:00
Torsten Ruger
a7207a9984 wrap parfait tests in module and boot 2018-04-26 12:31:37 +03:00
Torsten Ruger
30ba626cf9 fix knock ons 2018-04-24 20:16:50 +03:00
Torsten Ruger
6fc84d2f98 bit of renaming and a string test 2018-04-24 20:12:49 +03:00
Torsten Ruger
ee28d12429 bit more comparison testing 2018-04-24 19:57:14 +03:00
Torsten Ruger
2bd39bd3dd renaming 2018-04-24 19:46:22 +03:00
Torsten Ruger
ec5a7f8a02 implement larger/smaller or equal 2018-04-24 19:45:58 +03:00
Torsten Ruger
7a2160e9b4 fix comparison operator
< implemented <=
2018-04-23 19:39:16 +03:00
Torsten Ruger
ef5854c4df start larger tests 2018-04-23 14:05:37 +03:00
Torsten Ruger
1907574c60 bit of organising 2018-04-23 13:16:46 +03:00
Torsten Ruger
020bce740a more complex while test
that works, but does leave one wondering what is tested apart from the
result (1)
2018-04-20 19:38:33 +03:00
Torsten Ruger
6a8bb90704 test multiple assigns 2018-04-20 13:13:09 +03:00
Torsten Ruger
98f3898acd fix while tests 2018-04-20 10:27:06 +03:00
Torsten Ruger
bf6e0853ce fix while back jump
while normalising the condition had gone before the
jump target accidentally
2018-04-20 09:56:06 +03:00
Torsten Ruger
04359546b7 implement greater than 2018-04-19 22:57:31 +03:00
Torsten Ruger
be3d125b82 implement smaller than comparison
which is NOT an operator in the risc sense
rather a minus and a check for sign
(which _could be more efficient in arm, with conditional execution)
2018-04-19 22:41:40 +03:00
Torsten Ruger
9e21719aeb generalise the operator handling
ie passing them through
implementing more
2018-04-19 22:13:52 +03:00
Torsten Ruger
7d9132ee36 test other int methods
harness for testing compiler in a method (before just in a case)
2018-04-19 19:59:48 +03:00
Torsten Ruger
a98d7630fb start testing builtin seperately
in terms of output only
2018-04-19 19:47:35 +03:00
Torsten Ruger
1741ad540e move test helper code to support
to be reused
2018-04-19 19:33:40 +03:00
Torsten Ruger
13d8a65e07 add while interpreter test 2018-04-19 19:23:12 +03:00
Torsten Ruger
1849522a54 fix TruthCheck
mixing up the false and true, such a basic human mistake
2018-04-19 10:34:15 +03:00