Torsten Ruger
3d113b4d83
fix more of the changed names
...
add a few self.
2018-08-12 13:10:44 +03:00
Torsten Ruger
66e0d4ae26
cache index resolution
...
resolve once and reuse
also use non checking version of get/set
as index per definition must be ok
This creates some speedup, but mostly avoids some weird hang in Thread::Queue.pop for many seconds
2018-08-12 13:09:34 +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
b0aefe31fe
make all instances attr read writers
...
unfortunately the writers have to have self.var =
otherwise it is just a local var
Also need to make the type explicit for all
Protocol included memory_length on the class for now
2018-08-11 19:15:34 +03:00
Torsten Ruger
e6df473647
changing the adapter to have fake memory for every object
...
Before instance variables were used to store the actual data
While this worked it was a double mental loop and (more importantly) did not allow the same memory access
Ie, in the interpreter the types for args had to be set correctly
But they don't need to be until we walk the list, when we can get the types from the method.
In short, now the fake memory may be used as memory, by indexing into it
We now have to use attr reader/writers that map to the fake memory
And while this is possible, it means a lot more self. than i would like
Also the compiler whill have to undo those attr to instance acess at some point
2018-08-11 19:13:09 +03:00
Torsten Ruger
d74e9c2c40
removed some obsolete builder helpers
...
cleaner code with dsl,
just div10 undone
2018-08-09 21:10:05 +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
7002956e81
redid get_set internal byte with builder
...
trying to change style, get rid of some of builders functions
2018-08-09 20:15:52 +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
6200a35562
add shortcut for class_name
...
for when type is not set
2018-08-08 12:02:59 +03:00
Torsten Ruger
71a7161200
redid div4 with builder
2018-08-08 12:02:24 +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
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
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
5346077a72
use the return jump to jump to the return sequence
...
thus every method only has one exit
should make multi return messages smaller
especially when we have escape analisis
(maybe will help with inlining too)
2018-08-02 17:36:39 +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
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
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
1d2ec8e8ac
abstract CallStatement base class, just like in ruby
...
to_mom differs much more than the to_vool in ruby,
but data and base functionality still warrent unification
also we can check for CallStatement now
2018-07-30 14:45:37 +03:00
Torsten Ruger
198a43cc8d
rename callable to CallStatement
...
Callable is the Method, whereas here we call the method
2018-07-30 14:44:14 +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
165036ea39
misc
2018-07-30 10:26:47 +03:00
Torsten Ruger
2dc03f8d1b
push the callable into the callable compiler
...
thus generalizing for .callable access
keep block and method aliases for destinction in derived classes
2018-07-30 10:26:11 +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
6022aa4dab
introduce ruby variable and remove ct_type
...
cleaner oo
2018-07-20 20:53:35 +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
d03592dfb1
fix ruby return
2018-07-20 20:05:32 +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
ae3d64eb53
moved all the normalize stuff over to the ruby layer
...
Which is how it should have been from the start
2018-07-19 14:47:29 +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
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
280ea8a8c4
remove resolve_to_register
...
which was, quite simply, from another era when more than message was pinned
2018-07-16 19:19:49 +03:00
Torsten Ruger
73645e1507
rename resolve_type to infer_type
...
as we go from a symbol to a type, more or less by convention
also remove the compiler from there and other not used cases
No tests change, good refactoring
2018-07-16 19:17:57 +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
29363e7f72
split compilers resolve_type into the three possibilities
...
cleaner code, though temporary it shifts some dirt
into the index method. up next
2018-07-16 12:03:40 +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
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
a71a6d34fb
use message reg not message
...
for upcoming change
2018-07-15 15:14:38 +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
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
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
a3e758357c
extract base class from method_compiler
...
to be used for blocks too
2018-07-10 22:02:11 +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
4ac89ece66
start delegating scope matters to the compiler(s)
...
slot_type_for to return the slot way to access variable
this is off course version 0.0.1 alpha, no types are checked or errors handled
2018-07-09 17:53:56 +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
0d900de695
block creation and insertion with correct types
2018-07-07 22:42:00 +03:00
Torsten Ruger
7c4faf7b2a
fix broken test
...
guard was green before i pushed, i swear
No really
2018-07-07 17:34:48 +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
2ad24ab0bb
add to_s for statements
2018-07-03 22:18:19 +03:00
Torsten Ruger
e099014d63
fix dunamic jump in interpreter and misc
2018-07-03 19:15:36 +03:00