Alamvic / druid

Meta-compiler to generate an optimised JIT compiler frontend based on an Interpreter definition
8 stars 6 forks source link

Primitive value multiargs #132

Closed PalumboN closed 5 months ago

PalumboN commented 5 months ago

VM: https://github.com/pharo-project/pharo-vm/pull/763/

Support meta-compilation of primitives with variadic args (multiargs):

Using the pragma like this:

<numberOfArguments: #(0 1)>

Druid will compile a generator with the pattern:

    s1 := self methodNumArgs.
    s1 = 0 ifTrue: [ ... ]

    s2 := self methodNumArgs.
    s2 = 1 ifTrue: [ ... ]

        ^ 0

And also leave the entry in the primitiveTable without arguments (-1 at the end).


In this PR I also:

PalumboN commented 5 months ago

Some related tests are broken, I'll check them.

PalumboN commented 5 months ago

Tests are fixed (or most of them). We need to merge VM: https://github.com/pharo-project/pharo-vm/pull/763 before.