Commit Graph

2254 Commits

Author SHA1 Message Date
Torsten 4db71c1c03 fix all uses of operators now they are ssa 2020-03-22 14:31:43 +02:00
Torsten 0cde7c1d0a debugging to find operator not being ssa 2020-03-22 14:31:43 +02:00
Torsten 61fc8a3991 make operator_instruction single ass
create result register automatically
usually not used, but register allocation will sort that
2020-03-22 14:31:43 +02:00
Torsten 1378745907 first interpreter tests 2020-03-22 14:31:43 +02:00
Torsten c16ed5ab3a fix interpreter
by currently not checking for old register pattern
feels like wip, but passes (all but one)
2020-03-22 14:31:43 +02:00
Torsten f2250bc206 fix resolve and introduce method to chop strings to max
strings are 20 bytes. I want to implement the extension idea, just not now
2020-03-22 14:31:43 +02:00
Torsten 504fc3509e fix set_internal_word register 2020-03-22 14:31:43 +02:00
Torsten 5c13ea1433 fix naming mistakes fo Word.get/set macros 2020-03-22 14:31:43 +02:00
Torsten d125a1528a Fix set_internal_byte registers 2020-03-22 14:31:43 +02:00
Torsten 2656bfacb2 create a reduce_int on RegisterSlot
that just passes through to RegisterValue by calling to_reg
2020-03-22 14:31:43 +02:00
Torsten 17a1121408 fix putstring registers 2020-03-22 14:31:43 +02:00
Torsten 3a3a9277b3 fix operators registers 2020-03-22 14:31:43 +02:00
Torsten 8867d60c13 fix method_missing register
logic is still wrong, even it is slightly less (at least loading the method name)
2020-03-22 14:31:43 +02:00
Torsten cf5a3c0102 fix inits registers
surprisingly easy. shorter code and more readable tests
2020-03-22 14:31:43 +02:00
Torsten 8abcaa330b fix allocate in builder
which accessed unknown types.
also moved assert_allocate to support
2020-03-22 14:31:43 +02:00
Torsten c9fedec230 add a way to bend the type for register_value
specifically for factories, where we know the type of next_object even it is not specified
2020-03-22 14:31:43 +02:00
Torsten 05ddc70fd6 fix get_internal word register names
seems previous commits broke the return
2020-03-22 14:31:43 +02:00
Torsten 6267bf3ad0 fix slot_to_reg to allow register indexes
we mostly use pre-calculated indexes, ie integers
but registers are allowed (in arm/risc), so we try to check the registers type at least is right.
The return is really a machine word, but we call it Object (yes, more work that way)
2020-03-22 14:31:43 +02:00
Torsten 62d8d92b50 restrict list index to integer 2020-03-22 14:31:43 +02:00
Torsten a70e510548 fix test_exit registers 2020-03-22 14:31:43 +02:00
Torsten fb4fa598f2 fix get_internal_byte
improved operators and tests
some logic errors still
2020-03-22 14:31:43 +02:00
Torsten c1cfc12a1c converted resolve_method
Big, left till last, but surprisingly painless
2020-03-22 14:31:43 +02:00
Torsten 12fe0b9a10 add constants automatically 2020-03-22 14:31:43 +02:00
Torsten e6729b8b60 fixing instruction tests 2020-03-22 14:31:43 +02:00
Torsten 22d513d895 fix div4 and tests
also bug in reduce_int, compiler not carried through
2020-03-22 14:31:43 +02:00
Torsten eed9ba082f Fix div10 and test
fix and use load_data (similar to load_constant)
and integrate into load_object when appropriate (ie for integers)
2020-03-22 14:31:43 +02:00
Torsten bd02f69824 reduce_int was overwriting register
No more. But the type question is open, ie what type does the resulting register have
2020-03-22 14:31:43 +02:00
Torsten 53eb28fff4 load constant to create register names with class
Just the id_ did give no clue to the contents, just took care of the uniqueness.
Better for debugging
2020-03-22 14:31:43 +02:00
Torsten 3ec5557ddb fix builder logic error
and tests
2020-03-22 14:31:43 +02:00
Torsten 1760b5b203 fix comparison test and helpers
moving to passing the instruction number, not the instruction
so in the error message we can say where the error is
(otherwise minitest is good enough to supress the trace of asserts calling asserts)
2020-03-22 14:31:43 +02:00
Torsten 9c5d17a3bb Fix div10 without method_missing
but reanimate infer_type to auto create the needed regsiters
also some helpers
2020-03-22 14:31:43 +02:00
Torsten 9a5e0f15cd reannimate infer_type
now with a _purpose_
2020-03-22 14:31:43 +02:00
Torsten 3688c967d3 Fix comparison macro
which leaves a definite need for instruction level testing
2020-03-22 14:31:43 +02:00
Torsten 2af953e1d2 last instruciton, dynamic_call
next macros
2020-03-22 14:31:43 +02:00
Torsten 7f5ebab800 did block yield 2020-03-22 14:31:43 +02:00
Torsten a4c0b8e5f9 did return sequence
surprisingly easy. also some check polish
2020-03-22 14:31:43 +02:00
Torsten fd43fc9e5c finally fixes the builder 2020-03-22 14:31:43 +02:00
Torsten db5a59f735 Unify instruction namings also dirs
Was getting confused myself, where it was instruction or instructions, when if the base class was inside or out of dir.
Now dirs are plural, and base class is inside.
2020-03-22 14:31:43 +02:00
Torsten f3d299208e fix message_setup with new builder 2020-03-22 14:31:43 +02:00
Torsten ece1e8c87b fix some more of builder
but still not all. removed some and fixed the register allocation in allocate_int
2020-03-22 14:31:43 +02:00
Torsten ff49ff50c0 Convert SimpleCall to new regs
Also fix bug in RegsiterValue/Slot with chain, where logic was dodgy and compiler not set
2020-03-22 14:31:43 +02:00
Torsten 4b303977a7 Fix first Slot instruction that uses builder
now without method_missing and names
but still with instance_eval, hmm. Tried without, makes code much less readable
2020-03-22 14:31:43 +02:00
Torsten 4888b3b6db Starting to rework slot instructions that create risc
have to go through all and all macros and all thems tests. What did the wise man say: one step at a time
2020-03-22 14:31:43 +02:00
Torsten 4643be0ae6 codong RegisterSlot with reg and slot 2020-03-22 14:31:43 +02:00
Torsten 64d860b2bf create a load on the compiler
thus removing the need for << with objects on RegisterValue
2020-03-22 14:31:43 +02:00
Torsten 95f3eec043 repurpose RValue as RegisterSlot
with the idea of the better name came also the one about not needing the builder anymore
2020-03-22 14:31:43 +02:00
Torsten 088017bc05 SA for Slotted derivations
Object and Constant similarity are coming more into focus. Will unite after the merge
2020-03-22 14:31:43 +02:00
Torsten d22da1ab97 SA for slot_to_reg 2020-03-22 14:31:43 +02:00
Torsten 77003eed06 remove use_reg on compiler and SA for load 2020-03-22 14:31:43 +02:00
Torsten 0ce14bdfd1 moving to SA register names (wip)
starting to implement register allocation by first creating SA
Single Assignment means a register is only every assigned a value once. Hence for any operation involving another register, a new register is created.
We do this with a naming scheme for the registers in dot notation (as it would be in c) which means 2 registers with the same name, should have the same contents. This does not apply to temporaries, but that is another day.
Starting WIP now, and will create many red commits before merging when green.
2020-03-22 14:31:43 +02:00
Torsten 393f0d9a60 fix argument transfer (to be logical) 2020-02-27 18:19:27 +02:00
Torsten 685022a6e0 Externalise register allocation into own class
On the way to the register allocation
2020-02-27 11:57:18 +02:00
Torsten 8832df3221 Add number of registers to platform 2020-02-26 19:01:01 +02:00
Torsten Rüger 8df2e4bf08 SlotLanguage reborn in the Machine
Just added the compiler, that can parse Slot directly into SlotMachine code (no language layer in between)
Still unclear wheather the Maker is a thing, but since it was in the Language layer i did not remove it (yet)
Otherwise just the compiler and all the tests, moved from the slot_language.
2020-02-19 02:19:14 +07:00
Torsten Rüger d751c53d1d Add a SameCheck and rename the label
SameCheck is very similar to NotSameCheck, but only used from the language
Label was named jump, fixed that
2020-02-19 02:16:44 +07:00
Torsten Rüger b88c5ff498 Removing the SlotLanguage
I turned out that that layer did not provide benefit. Data was being shuffled, without gain, so i moved the compiler to the SlotMachine
2020-02-19 02:14:34 +07:00
Torsten Rüger 2d11078a37 Slotted constructor cleanup 2020-02-17 14:45:54 +07:00
Torsten Rüger c1679bd6ff Makes slots linked list
slots used to ba an array of symbols
Now we have an object for each slot, that holds the name and the next_slot
relatively easy change, though quite broad
2020-02-17 14:29:45 +07:00
Torsten Rüger 21817b182e Start to make slots recursive 2020-02-17 14:26:50 +07:00
Torsten Rüger b7df6f66f9 rename the XX_slot classes to SlottedXX
move to slotted and slots (wip)
2020-02-15 21:05:04 +07:00
Torsten Rüger 8b29326957 moving know_object out of the base class
object is only common to constant and object slots (which should be unified)
On the way to making the array recursive
2020-02-15 15:32:22 +07:00
Torsten Rüger 6aa6b32c50 move slot out of instruction dir
since it is not an instruction, just a helper
also doing this before rewriting slot recursively
2020-02-15 14:52:44 +07:00
Torsten Rüger 24ceb20281 cleaned up chained assignment and conditional
Making this almost usable
2020-02-13 19:45:47 +07:00
Torsten Rüger a153fde3f0 Fix variables to chain recursively 2020-02-13 19:09:00 +07:00
Torsten Rüger 6194148fc5 Rename SlotMaker to Variable
Feels like now with better names, i can start to work.
2020-02-13 13:10:04 +07:00
Torsten Rüger c194d373fb rename LoadMaker to Assignment 2020-02-13 13:02:23 +07:00
Torsten Rüger 99d2868400 Rename check_maker to equal_goto
will have different classes for different checks, started that
2020-02-13 12:53:41 +07:00
Torsten Rüger 0342df41c7 introduce goto instead of using machines jump
fix labels so compiler does not return duplicates
2020-02-13 11:59:00 +07:00
Torsten Rüger 0e3a8bb859 cleaning, docs 2020-02-12 15:41:16 +07:00
Torsten Rüger 3c762c4fe7 Rename SlotDefinition to Slot
And the derived XXDefinitions to XXSlot

Just to be more consistent
And possibly free the Definition for the Language side
2020-02-11 16:19:52 +07:00
Torsten Rüger 31c8a0aac5 refactored the SlotLoad into SlotDefs
That sort of removes the last horrible code.
Surely can still be improved, but mostly oo now
2020-02-11 16:03:51 +07:00
Torsten Rüger 8d02d82ff2 now object slot , almost done 2020-02-10 19:28:48 +07:00
Torsten Rüger 1da5cd16c3 more splitting of slot code
now constants, still wip
2020-02-10 19:07:12 +07:00
Torsten Rüger 24d7fe25da first steps to defining specialised slot classes
getting rid of the mess in SlotDefinition (wip)
2020-02-10 18:36:21 +07:00
Torsten Rüger df4fd409c1 getting back into it 2020-02-09 21:33:34 +07:00
Torsten Rüger 5b27ae7ddf use env, not class var aas compilation switch 2020-02-08 17:44:35 +07:00
Torsten Rüger 61b6496029 misc 2019-12-01 12:17:54 +02:00
Torsten Rüger 308670b90c Start to transform SL into SM 2019-10-07 20:14:40 +03:00
Torsten Rüger 8cac5c064d Start nexr level p i SlotLanguage, calling it MacroMaker
Since we already have Macros. Macros are nothing more than a list of SlotMachine Instructions. This is what we are aiming to create (which is also what is created in Sol .to_slot)

So the idea came to slot the MacroMaker in there after its done
2019-10-06 19:49:53 +03:00
Torsten Rüger cbbb0c2f07 More on slot assignment
which turn into slot_load
2019-10-05 19:37:24 +03:00
Torsten Rüger 2c7944af85 if and goto for slot_language 2019-10-05 14:49:45 +03:00
Torsten Rüger 9885841eb4 SlotLanguageExploration 2019-10-04 21:06:22 +03:00
Torsten Rüger 901f7b0132 Mini start to the new SlotLanguage 2019-10-04 17:38:51 +03:00
Torsten Rüger d1f8733623 Rename Vool to Sol
Simple is really the descriptive name for the layer
Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified)
Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else
Just cause i was renaming anyway
2019-10-04 00:38:47 +03:00
Torsten Rüger aa9fc8bc81 More rename cleanp 2019-10-03 21:07:55 +03:00
Torsten Rüger c43436f35a Change Mom to SlotMachine
rather large commit, but essentially a simple rename
Rationale in docs and blogs
2019-10-03 20:55:41 +03:00
Torsten Rüger fd8a3e9cc5 some cc driven cleanup
bit anoying that the builtin engine is used
Even it is not as well configurable as preferred reek.
Still, found one minor bug
2019-10-02 17:54:42 +03:00
Torsten Rüger 48e18ac9cd the superclass of a singleton class is the singleton class of the superclass
And i have tests to prove it!
That just rolls of the tongue, it had to be the commit message
2019-10-01 20:55:05 +03:00
Torsten Rüger 2dcb2a9a72 Introduce singleton types
Just for future, as this gives us a way to know immediately in the type, which represent normal, and which singleton classes
Also instantiate singleton class lazily (with singleton type)
This makes the type of class single, ie unique, immediately when it is used, ie methods or variables defined.
Fixes a design mistake, where all singletonn classes shared the same type, and thus unique methods per class were impossible
(Also some misc in commit)
2019-10-01 19:42:16 +03:00
Torsten Rüger ba83affd8c fix resolve issue
the typed method has to be created in the to_pafait pass for it to work correctly, ie for the sends to have something to call

also means that when during compilation creating (raising?) a  method, not only vool. but also callable has to be created
2019-09-29 22:37:28 +03:00
Torsten Rüger 17f87f7464 Starting to fix resolve mechanism
resolve had the wrong approach, sort of class based oo
It took methods from "derived" types and just used them
To be correct, those methods would have to be recompiled for the current type, rubyx is type, not class based.
Started on that, still soe strange hang though

Later, type and method analysis may reveal "compatible" types (down only off course) where one could use the exact same code, but that is phase 2
2019-09-29 12:06:37 +03:00
Torsten Rüger 1e5073200c Remove separate block_compiler lists
both in mom and risc method complers
alll just compilers now, all linked
Required to move some code down into callable_compiler but all in all quite little. cleaner
2019-09-28 17:24:10 +03:00
Torsten Rüger dcbc3e17be refactor risc_collection
move code that operates on compiler to the compiler class
this leaves the collection thin, very thin indeed
2019-09-28 15:37:02 +03:00
Torsten Rüger 9f81d78767 Also make risc compilers a linked lists
also via util::compiler_ist
leave collection as much in place as possible
(though collections and seperate block_compilers are about to go)
2019-09-28 15:08:08 +03:00
Torsten Rüger 2eb9364283 make mom:method_compiler a list
Compilers forms alist by Util::CompilerList
Change Collection to use the list instead of array
2019-09-28 12:41:38 +03:00
Torsten Rüger aba42a6836 Simple compiler list module to make compilers a list 2019-09-28 09:38:34 +03:00
Torsten Rüger 701890f625 Fix bad test coverage
One typo, one debug test
Also stop producing those object files, use in memory io
2019-09-25 01:14:00 +03:00
Torsten Rüger 1022390e0f check for redefining of methods and forbid
causing some test problems, but better that way (until it's done right off course)
2019-09-24 21:20:12 +03:00
Torsten Rüger 3df54910cc rename singleton_class to single_class and misc
was clashing with real ruby method name
also many superclass mismatch fixes
some misc
2019-09-24 17:25:19 +03:00
Torsten Rüger dd810cfc49 Make to_mom a 2 stage process
First baby baby step on the way to passes
Create all parfait objects in first pass, so methods exist to be resolved in second path
2019-09-24 15:44:33 +03:00