e61c5d4a55
Simplify Parfait booting
...
Since some weeks, Parfait uses instance variables instead of generated attribute getters (that needed type)
This makes it possible to simplify the boot process, getting rid of separate boot Space and class versions.
It is still quite order dependent, but all "normal" ruby code, (less magic) so easier to understand.
Also moved all code that can never run at runtime into the adapter. This included Space and Object new, space as the space will only ever be created at compile time and object, since that is quite different at run-time (which is where i am working towards)
2019-09-22 19:10:47 +03:00
a496ea7e4b
Derive Class and MetaClass from Behaviour
...
Finally! If i remember the module was from before i had any non Object superclasses
unified code, unified bugs :-) just makes sense
2019-09-21 18:50:33 +03:00
3b7248df4e
more class test and misc
2019-09-21 18:16:58 +03:00
113ba8607c
fix to_s (mostly)
2019-09-19 20:48:21 +03:00
1e2c4d6678
More tests and compiling parfait object
2019-09-19 17:41:26 +03:00
fd46826b9c
Implement class instance variables
...
as they are just the type of the meta_class, that was relatively simple.
I feel this is what oo is meant to be, instance variables and methods for the objects, and since classes are objects, for them too.
Class variables seem like a design mistake, weird scoping rules and no data hiding (left as an exercise to the reader)
2019-09-19 15:48:27 +03:00
b0d1948800
Moving space to object class
...
away from Parfait module, as that gets collapsed
Leaving shortcut outside parfait for now
2019-09-18 22:36:56 +03:00
41617519d9
some class send test changes
...
also ivar, which is still wip
2019-09-18 22:07:58 +03:00
38491d120b
removed unused NamedList
...
args and locals got inlined into message, forgot to delete then
ripples out due to type creation
small type class api change, more ripples, but also more consistent
2019-09-18 22:07:05 +03:00
f13e8b3bd7
A little work on test times
...
They have been rising of late, installer reporter to check 8and keep checking)
tweaking of cli parameters
removed redundant interpreter tests
2019-09-18 13:36:29 +03:00
e56db0a3ac
get method name out from method_missing
2019-09-17 20:18:00 +03:00
d58ed8e5e8
remove dead code that was produced
2019-09-17 16:08:49 +03:00
61819b7230
removing old brittle tests
...
that were replaced by instruction and macro tests
2019-09-17 14:28:19 +03:00
92f1921e2f
Last mom instruction test
2019-09-17 14:16:56 +03:00
f7f981dca4
Tests for return instructions
2019-09-17 13:52:20 +03:00
a256cf1e01
detailed method resolve test
...
revealing first bug (non critical, dead code)
2019-09-17 10:18:45 +03:00
830fe2ab2b
More instruction tests
2019-09-17 10:16:59 +03:00
b46512a1b8
tests for mom check instructions
2019-09-15 19:57:15 +03:00
5ab021de5a
Continue testing mom instructions
...
especially with the custom asserts, gadda say
mesa lika disa
2019-09-15 18:31:10 +03:00
6f108f67d7
Starting to build detailed mom to risc test
...
so we can get rid of brittle risc folder tests
All of those tests rely on many many implementation details
should just test result through interpreter, no chain.
2019-09-15 17:44:35 +03:00
d913bb01de
use method missing in resolve method
...
not just exit
try to print name next
2019-09-15 15:13:11 +03:00
7ee57f2b08
generalize get_main and get_init to get_method
...
to get at those know methods that really
__must__ exists, hence the bang, raise if don't
about to add method missing and raise to the list
2019-09-15 12:58:43 +03:00
b36ba42990
Test complied parfait tests
...
this makes it obvious that we need a working raise
and a correct method_missing, so we can diagnose the
resulting errors
2019-09-15 12:18:31 +03:00
56398e1127
Fix load order, travis obviously different
...
support files were loaded different locally than travis
probably time stamp, vs abc
Anyway, don't rely on dir order, make requires explicit
2019-09-13 22:06:18 +03:00
1ee01622c3
Builtin is no more, final conversions done
...
All preloading where it needs to be
(some)tests for the preload
split compiler test
remembered binary tests (usually just run on travis)
2019-09-13 20:34:41 +03:00
8af17a69ea
splitting commpiler commands and adding preload option
2019-09-13 19:08:59 +03:00
12b29285d7
Lots of preloading for tests
...
so many relied (implicitly( on some builtin function
after all can't do much in ruby without calling
Now all those dependencies are explicit
Small risc changes come because the macro version has a return label and unreachable label
2019-09-13 14:07:12 +03:00
c9d7539479
rework macro tests, or are they builtin
...
small fixes too
2019-09-13 10:42:20 +03:00
4bf23defc8
fix many tests with preloading
...
preloading, something akin to builtin, loads some very small predefined (macro) methods for the tests to work (ie call)
2019-09-12 22:27:26 +03:00
e33b9f565d
some renames before main fixes commences
2019-09-12 13:10:31 +03:00
616dd3487c
renaming mom builtin to macro
2019-09-11 20:33:49 +03:00
5ea91df4c1
Integer macros tests and defs
2019-09-11 19:23:56 +03:00
e8bfb9a58c
tests for word macros
2019-09-11 18:53:20 +03:00
f264aec94a
macro tests for all object mom instructions
2019-09-11 18:43:20 +03:00
2c4f040654
starting to move builtin into parfait
...
single object method for now
little framework next
2019-09-10 20:40:41 +03:00
feeb9332a2
cleaning
2019-09-10 16:21:13 +03:00
72643ebb08
Fix last parfait bug
...
missing return statement (duh)
2019-09-10 14:49:02 +03:00
63323376e4
use more instances in parfait
...
and misc
2019-09-10 12:33:57 +03:00
d82cedf4c0
Quite small amount of parfait tests needed changing after that
...
But something is amiss anyway, especially dynamic jumps
2019-09-09 20:29:18 +03:00
104f4c5109
Start on parsing parfait tests
...
Hanging on .new currently, but there is surely more
2019-09-09 11:48:29 +03:00
0ae7c5d8aa
hacking method not found
...
was using exit, since raise is not implemented. This was ambiguous as all programs exit.
Using :died as special kernel code and bending it, and reporting it in interpreter.
2019-09-09 11:47:37 +03:00
7334e72458
Weird to be finding Parfait word bugs now
...
but index maths is also much easier 10th time around
2019-09-08 21:14:54 +03:00
6811fc4174
fix interpreter to output symbols
...
which amazingly lets us get at classnames etc
2019-09-08 15:31:03 +03:00
a99abd7ad0
update gems, remove ssh
2019-09-08 13:44:51 +03:00
1a096110a8
basic require_relative (hack)
...
opted to hack require to be getting on
need require for the test helper
and the files in lib/parfait
General require mechanism would still be ok, but require_ralative means implementing file source, which needs to be dragged around. I'll make an issue
2019-09-07 22:13:53 +03:00
b13c19def3
cache booted functions
...
remove more redundant parfait boots
2019-09-07 17:56:06 +03:00
2c681bf2e5
Add mom boot options
...
and remove a lot of stale parfait boots from tests
(from before using rubyxc)
2019-09-07 16:43:47 +03:00
1539904ee2
Starting to parse parfait tests
...
will have to detour via require next
2019-09-06 21:02:09 +03:00
363d1cb36f
fix module handling at ruby level
...
Was returning arrays instead of Statements, which messed things up
2019-09-06 21:00:37 +03:00
646797301e
rearrange test helpers for later
2019-09-06 20:59:14 +03:00
f126aa52df
Descope Parfait in the compiler
...
Compiler now removes the module Parfait scope
and also the ::Parfait:: Scope in module names
Which means we can compile scoped code
and get unscoped code. for Parfait
Handy for tests too
2019-09-06 13:59:33 +03:00
7d92ee9e6a
add a statistics command to compiler
...
just to see how many objects make up a binary
2019-09-05 13:25:40 +03:00
91995dc1b3
make elf symbols optional
...
and default to false. Smaller executables by at least half
also add option for compiler cli
2019-09-03 02:02:21 +03:00
160d860db2
using new macro approach for builtin, testing first
2019-08-26 09:24:06 +03:00
b9bdc55059
A good start on the macro idea
...
I call it macro because it lets you insert basically arbitrary risc code into the ruby level. The way it works:
Reserve namespace X
map any X.some_call to a Mom instruction
by the name SomeCall
which must take the same args in constructor as given
And obviously produce whatever risc it wants
Hoping to rewrite builtin around this idea (with the existing Mom builtn instructions)
2019-08-25 14:40:59 +03:00
c0a3c9b65c
block version of loop
...
no debugging, just worked!
only about 10% slower, nice
also recording qemu-linux times, which are a lot faster(and double bonus, save the startup/syncing)
2019-08-24 17:00:59 +03:00
d3a0aa3d8e
redid benchmarks with new options
...
especially calling did improve
also binaries don't get crazy big even for bigger heaps, because they are just ints
2019-08-24 16:03:35 +03:00
259edb51e9
adding parfait options to compiler
...
to make smaller binaries with larger integer heaps
also ran some benchmarks to see if it makes a difference
at least the binaries are smaller, calling also faster
2019-08-24 11:44:13 +03:00
02261ad79d
changing factory size per factory
...
Before it was one class variable, but ints and messages are not created in equal amounts.
2019-08-24 09:46:33 +03:00
86b27ab319
CC change test fixes finished
2019-08-23 19:25:02 +03:00
4656ea8ffb
fix all mom tests
...
still quite brittle, but easy to fix
2019-08-23 19:24:18 +03:00
4ca16e5f9a
fixing most of the risc tests
2019-08-23 15:31:22 +03:00
50c172915e
fixing most of the mom tests
2019-08-23 15:31:04 +03:00
5e44e9caaf
fix mom and vool after cc changes
2019-08-23 10:21:22 +03:00
ec1e8c8f3a
Fix risc layer from cc changes
2019-08-23 10:20:39 +03:00
7ca3599c5a
Fixed all after changing argument handling
...
arguments are now fully inlined into the message
locals next
2019-08-22 23:10:29 +03:00
017e7e2971
fix most of mom from calling changes
2019-08-22 22:56:44 +03:00
0c49612e5e
vool working after message change
2019-08-22 21:24:02 +03:00
0a1b05b2ee
Inline arguments into message
...
thus removing indirection for access
does affect rather much, several commits
2019-08-22 17:55:19 +03:00
c13d4fb017
Make builtin tests more stand alone
...
not relying on the whole boot process
easier to test basic when broken (like now)
2019-08-22 17:52:19 +03:00
5dc8c046e7
increase binary_code size to 32
...
save a few jump, adds some size to binary
16 just seemed kind of small
2019-08-22 12:26:40 +03:00
57b0ad2c32
Fix super as statement
...
Super is a statement, a send really.
Not an expression (as maybe in c++)
The actual implementation will be a bit tricky, like raise, a bit of stack walking, but not impossible. Still, later
2019-08-19 18:48:13 +03:00
0e694a38f7
Implicit returns for class methods
...
gets us parsing of parfaits second file data_object
2019-08-19 15:56:15 +03:00
d5d1df951c
Block/Lambda rework done
...
recovered from all renames and redoing the block compilation
all green
2019-08-19 15:23:57 +03:00
a722a4c285
Move vool block compilation into constant generation
...
When the lambda is passed as argument, it must be moved. This triggers the generation of a corresponding parfait object (as before, and as for other constants) but now also triggers the code build. The code being the constant as it were
Also some more name fixes from renames
2019-08-19 14:33:02 +03:00
3ddf2e3837
Redoing ruby block conversion
...
Since the block is actually a constant, it does not need assignment or special hoisting
Just use the send and stick the lambda in as last arg
2019-08-19 14:23:55 +03:00
f87526f86f
Renaming Vool exppressions rightly
...
Class, Method and Lambda (was block) are expressions.
Just making things clearer, especially for the blocks (ahem, lambdas) is matters.
wip
2019-08-19 11:33:12 +03:00
ae16551ed0
Rename Vool Block to Lambda
...
Making the distinction clearer
Some fixing of previous (wip)
2019-08-19 10:40:22 +03:00
02807cf6f9
Rename Block to RubyBlock at Ruby level
...
The parser presents the whole call that defines the block as a block. And so does the Ruby layer, as we don't want to do processing in ast.
Just making it clearer, also Vool:: block will have to be renamed
2019-08-19 10:31:11 +03:00
4f3d117e40
Object dogfood, compiling parfiat to binary
...
Object is the first (obviously) Parfait object to parse and fully compile to binary.
No tests yet, but almost 500 lines of real world code with 17 methods, not bad
2019-08-18 20:41:49 +03:00
ee8927b059
Fix slot access for constants
...
Type access is allowed for any object, including constants.
Needed for parfait
2019-08-18 20:35:01 +03:00
5a80850975
still debugging travis (for arm tests)
2019-08-18 15:40:40 +03:00
6547b1608d
Ok, any fail makes it go red, now i know
...
also making command configurable as they seem different on ubuntu (16?)
than fedora 30 (and who knows where else)
2019-08-18 15:30:52 +03:00
02a4742cc2
Backticks raise exception, who knew
...
catching and tryig different exe name
2019-08-18 15:22:09 +03:00
c9d77a29b2
Running tests on binary through qemu (system, no ssh)
2019-08-18 12:39:23 +03:00
15d1c07a1c
Remove dead code
...
some copy paste in creating full mom layer left dome unused (untested)
code
thanks to code climate stats
2019-08-18 10:19:52 +03:00
5a43cbff15
Fixing tests for implicit return
...
previous commit affected rather many test, as the implicit returns add extra instructions
Also added some explicit returns, so as not to test the return logic too much. return (ie return nl) is a knonwn 3 risc operation.
2019-08-17 23:29:42 +03:00
4c76ff3388
Remove Padded module
...
Parfait was depending on it, ie it created a dependency out of Parfait. But Parfiat needs to be self contained.
Moved 2 methods into parfait object, and resolved single call from text_writer to third.
2019-08-17 21:07:07 +03:00
ae7f31381b
Fixing self type creation
...
When compiling a classs, we pick up all instance variables.
Now that conditions and returns can be calls, that was broken, now fixed
2019-08-17 15:58:27 +03:00
d3f3c91ae5
Fix all but one test
...
Riples upon riples. The one left looks like the genuine article
2019-08-16 21:43:54 +03:00
7c91a08d5b
Fix vool assignments after call rework
...
also small fix for if and return, as they need to execute sneds and yields (not just sends), so testing for Call not SendStatement
2019-08-16 20:39:08 +03:00
e6c30d98fb
Fix if statements hoisting, now that send is working
...
Same same, just have to remembe to actually execute the condition if it is a send
Having send a possible expression, removes one tmp variable and associated move, for a little extra work.
Next return and assign (rest)
2019-08-16 18:42:57 +03:00
c213cf874b
Fix ruby normalising to_vool
...
So that vool layer never has complex conditions or returns
Start with while, next if, return and assign
2019-08-16 14:20:06 +03:00
84b9811e55
Fixing ruby send with arguments
...
When send has complex args, mostly more sends, we hoist those out and pass created temporary variables
2019-08-15 21:30:36 +03:00
31ae0a9670
Add support for unless
...
ifs without a true branch would crash before
Somewhat more verbose but unified
2019-08-14 22:24:35 +03:00
d6c38d15ba
Fix calling unknown methods
...
Before, when the type was determined, it was assumed that the method can be resolved. But off course tis is not true, as methods may be defined later in the file.
Two solutions for that. One could (and should) define all methods and only then start to compile. Thus having the type safety.
Or (as now) make a dynamic call and let it fail at runtime.
2019-08-14 14:59:54 +03:00
b2260d856d
And we are green again
...
After having over 600 failing tests at one point, this does feel good.
Even better, most of the risc/interpreter tests where i didn't change anything came gree without changing the tests. ie we have binary compatibility.
2019-08-14 11:11:26 +03:00
c13a8ceb11
all of mom and vool
...
with working block tests this time
2019-08-13 20:35:27 +03:00
155c042009
Fix forgotten block compiler
...
Especially on the way down to risc
2019-08-13 19:32:17 +03:00
8036b23593
Fixed more disabled tests
2019-08-13 11:14:36 +03:00
aaf169ad8d
Fixed almost all but Interpreter
...
150 only failing, seems only 1 bug though
and one in linker
2019-08-13 00:13:29 +03:00
9474932320
fixing risc collection tests
2019-08-12 16:12:17 +03:00
9a2716280c
Extracting the mom instruction from builtin modules
...
Since they were embedded at first (easier copy/paste) they now got own files, like their brethren
also mini tests for each instruction , nice start
2019-08-12 13:16:15 +03:00
fa0aa30386
Move builtin wholesale to Mom
...
Since Builtin generates risc, just like mom instructions, it was a design mistake to put builtin into risc in the first place. Now that borders are coming more into focus, it make much more sense to have the builtin in mom.
In fact the instructions should be moved out and a seperate invocation mechanism used , so functions can be parsed, not generated (wip)
2019-08-12 12:38:29 +03:00
a4b6f29834
Booting functions again and send test
...
both class and normal sending tests at vool / mom level
2019-08-12 11:57:32 +03:00
2326081161
Now booting all original methods
...
Just need to refactor now
2019-08-12 11:31:47 +03:00
91ddae2251
Start to convert integer operations
...
All apart from operators, which are its own thing
2019-08-12 11:08:09 +03:00
97488c4e5b
Transform builtin word functions
...
according to same schema
2019-08-12 10:45:07 +03:00
3282e0ae06
transformed object builtins
2019-08-11 20:36:10 +03:00
0725f02e9a
starting to fix builtin
...
start at Object get_interna_word
using the pattern to replace the whole risc method with a single mom instruction. Copying the original risc code into the instrucitons to_risc
also adding some very basic tests
2019-08-11 14:31:00 +03:00
0b59c95218
more test fixes and more to do
2019-08-10 21:59:31 +03:00
213938075f
fix most mom and risc apart
...
apart from things involving builtn, which is not yet conceptually solved (as it codes risc, not mom)
2019-08-10 21:30:00 +03:00
d5f89a4979
compile from mom compiler to risc
2019-08-10 12:42:47 +03:00
5994cd3276
starting on mom to risc
...
some docs too
2019-08-08 12:19:27 +03:00
82c9f1d97f
more and better tests
...
especially vool
2019-08-08 12:18:36 +03:00
Torsten Rüger
d5625a70d7
fix a whole bunch of vool to_mom
...
All but those requiring boot functions
2019-08-07 15:09:26 +03:00
Torsten Rüger
1237e079f7
Some vool starting to work again
...
disabling some rubyx compiler tests
2019-08-07 12:06:06 +03:00
Torsten Rüger
5d1d485565
move mom instruction up one
...
just like the risc one, also some basic tests
2019-08-06 20:44:39 +03:00
Torsten Rüger
66c2adda20
Copy risc compiler stuff to mom
...
Start to separate the layers.
wip, just checkin in to see the following changes better
2019-08-06 18:33:27 +03:00
3c0ba4f2ab
Merge branch 'master' into new_mom
2019-08-01 09:20:34 +03:00
7daf015ed2
small refactor
2019-08-01 09:20:08 +03:00
6b1c316f04
add simple loop bench
...
fiddled with run numbers a bit
recording times with noop removed
results slightly worse than hoped
2019-07-31 21:18:03 +03:00
8eb0ba0d81
fix benchmarks
...
up to 20 recursive fibo
had mixed add and calls for rubyx
2019-07-30 21:16:24 +03:00
6273ab769c
redid the old benchmarks
...
With #26 out of the way, was able to get meaningful rubyx benchmarks. Meaning loops large enough for the exec time to go significantly over the noop.
Did mruby too and as expected got much lower noop
2019-07-30 13:55:29 +03:00
ab87806d08
fixes #26
...
only recurse to 1k
then come up for air an go again.
Should allow for 1M objects on a 2k stack (previously exceptions at 3.6k)
2019-07-28 16:42:40 +03:00
95af84e752
fixing test to pass
...
and extract own kind of same tests to bench
bench tests will need some loop, but not as large as c
2019-07-25 21:25:15 +03:00
00bf38a0e6
updating benchmarks
...
on the new machine, consistent
not rubyx yet
2019-07-23 20:14:28 +03:00
fdb940e43f
stashing
2019-07-22 15:21:16 +03:00
Torsten Ruger
1391667f6c
still doing attr_reader, but closing #25
...
cattr still missing, but only one occurence. Later.
2019-03-07 11:00:18 +02:00
Torsten Ruger
5ed6a07083
better test for attr
...
still #25
2019-03-07 10:47:48 +02:00
Torsten Ruger
04720d4950
implement attr setter correctly
...
part of #25
still need to do for list and attr_reader
2019-03-06 11:21:09 +02:00
Torsten Ruger
b4b1e6e13b
start rewriting for parfait #25
...
just some infrastructure for now.
2019-03-05 20:36:40 +02:00
Torsten Ruger
11c5389e24
Fix if logic error
...
ifs may have an empty true block
Especially for unlesses thet is normal, so allow
2019-03-05 20:30:24 +02:00
Torsten Ruger
fb89c01681
clean up test option handling
2019-03-04 10:24:08 +02:00
Torsten Ruger
eec72a9fca
Successfully interpret class methods
...
just about closes #24
2019-02-27 09:48:21 +02:00
Torsten Ruger
461a6933c6
better tests for class sending
...
still #24
2019-02-23 18:17:26 +02:00
Torsten Ruger
0ebb8e31c6
to_s for parfait list
2019-02-17 18:16:19 +02:00
Torsten Ruger
e430701645
Using MetaClass to compile class methods into
...
still #24 , still wip
2019-02-17 14:37:50 +02:00
Torsten Ruger
3db7707614
Get a basic MetaClass going
...
Does get created in new, but not in boot.
Also not yet used in compiling
2019-02-16 23:24:16 +02:00
Torsten Ruger
2fbea82039
bring class methods down to mom
...
not functionally correct, still compiling into class, not metaclass
part of #24
2019-02-16 17:54:45 +02:00
Torsten Ruger
40581494de
class Methods down to vool #24
2019-02-14 19:24:12 +02:00
Torsten Ruger
86e3103543
More or less a stash
2019-02-12 22:41:42 +02:00
Torsten Ruger
37571a0ff9
Add ruby class methods
...
Ruby parser and ruby level for #24
2019-02-12 22:36:37 +02:00
Torsten Ruger
403540b3ca
slightly better messages for unsupported ruby
...
Very slightly unfortunately, just just enought to find the error.
Also testing what is unsupported, so it's documented.
2019-02-10 21:02:16 +02:00
Torsten Ruger
a89301d623
finally creating less objects in the test
...
basic still #23 , now applied
Basic size of 20, interpreter gets 50 and the full set is 1024
Tests run more than twice as fast!!
2019-02-09 12:44:35 +02:00
Torsten Ruger
37eeb81f45
fix all tests for previous commit
2019-02-08 23:03:23 +02:00
Torsten Ruger
8d3a1954fa
close #21
...
Mostly replaced Fixnum with integer
also in the rx-file dependency
all travis and testing with 2.4+
2019-02-07 18:24:35 +02:00
Torsten Ruger
51eff62931
Very basic cli to compile ruby files
...
Off course this is basically a cross compiler and the files
have to be transferred to an arm machine (and fixed as per note)
close #22
2019-02-07 11:07:57 +02:00
Torsten Ruger
4d30727811
test and last fixes for previous commits (allocalte ints)
...
mostly just fixing the additional instructions
close #20
2018-11-24 22:40:22 +02:00
Torsten Ruger
a8d1f070f1
replace add_new_int in most builtins
...
in integer and word mainly, replaced with allocate_int
(tests pending as syscalls are undone)
2018-11-21 20:29:22 +02:00