Commit Graph

198 Commits

Author SHA1 Message Date
66728f09f4 Fix meta_class, sis class instance variables and class methods
after some serious recursive thinking it now actually makes sense.
The key was to change the actual type of the class that the meta_class manages
For objects it's (still) ok just to change the instance_type, but since the class object exists and has type, when adding instance variables, that actual type has to change
2019-09-24 12:59:22 +03:00
7b40bb9106 Fixing new parfait boot process
mostly about setting the types to existing objects. 
Then after space is in place, it is set automatically

also a fair bit of misc in the commit
2019-09-23 00:07:30 +03:00
3b7248df4e more class test and misc 2019-09-21 18:16:58 +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
41617519d9 some class send test changes
also ivar, which is still wip
2019-09-18 22:07:58 +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
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
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
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
5e44e9caaf fix mom and vool after cc changes 2019-08-23 10:21:22 +03:00
0c49612e5e vool working after message change 2019-08-22 21:24:02 +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
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
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
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
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
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
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
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
0b59c95218 more test fixes and more to do 2019-08-10 21:59:31 +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
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
fdb940e43f stashing 2019-07-22 15:21:16 +03:00
Torsten Ruger
461a6933c6 better tests for class sending
still #24
2019-02-23 18:17:26 +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
37eeb81f45 fix all tests for previous commit 2019-02-08 23:03:23 +02:00
Torsten Ruger
308996bf8e fix all tests accordingly to new return 2018-08-02 17:37:27 +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
1cb07a4164 block arg access was off by one 2018-07-27 12:16:06 +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
9548440949 remove old tests
those normalisation tests are now to_vool tests
2018-07-20 20:10:12 +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
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