Commit Graph

394 Commits

Author SHA1 Message Date
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
1e2c4d6678 More tests and compiling parfait object 2019-09-19 17:41:26 +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
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
5ab021de5a Continue testing mom instructions
especially with the custom asserts, gadda say
mesa lika disa
2019-09-15 18:31:10 +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
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
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
616dd3487c renaming mom builtin to macro 2019-09-11 20:33:49 +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
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
b13c19def3 cache booted functions
remove more redundant parfait boots
2019-09-07 17:56:06 +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
4ca16e5f9a fixing most of the risc tests 2019-08-23 15:31: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
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
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
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
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
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
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
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
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
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
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
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
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
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
bbb7dbef75 First part of int allocation
implemented allocate_int
instead of add_new_int
2018-11-21 11:12:39 +02:00
Torsten Ruger
8a81d41d5e Move booting to RubyXCompiler init
Also pass the source into the compile method.
This way compiler can be reused for subsequent compile.
Does remove some double boots, but no major time save
2018-09-02 13:57:19 +03: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
b2339dc330 fix address nil values 2018-08-30 16:38:00 +03:00
Torsten Ruger
c983dcf0eb move return address generation to factory
removes the list from space
adds a ReturnAddress factory instead
and uses these throughout
2018-08-29 21:02:49 +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
d396da16e3 start with #14 by implementing factory
page was maybe a too low level name
pages may be the unit of the syscall, but after that objects desolve (maybe later to be added on from different pages)
Factory has the job of handing out a new instance of a type
it keeps a freelist for that and a reserve
2018-08-23 19:55:06 +03:00
Torsten Ruger
57dc6c45bb remove the code_builder
this is core of #11
rename compiler_builder to just builder
and change all builder uses to use that
some test change as code is not returned anymore
2018-08-19 13:16:07 +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
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
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
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
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
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
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
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
3343017dba move type resolution to compiler
from risc_value.
also unite mock compilers
2018-07-16 11:46:18 +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