Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial ULM hook implementation #26

Merged
merged 43 commits into from
Dec 9, 2024
Merged

Conversation

sskeirik
Copy link

@sskeirik sskeirik commented Dec 3, 2024

This PR does several things:

  1. it makes the ulm-wasm Makefile target conditional on the ULM_TEST variable --- if this variable is set, a standalone binary will be built; otherwise, a ULM-integrated library will be built
  2. it adds three required ULM hook impls to ulm-wasm.md
  3. it adds the GAS and CREATE and ENTRY config variables to ulm-wasm.md
  4. it gives ulm-wasm.md tangle tags to conditionally build a ULM-integrated initial configuration vs. a standalone initial configuration

@sskeirik sskeirik force-pushed the initial-ulm-hook-impl branch from a89138a to 56107a3 Compare December 5, 2024 19:23
@sskeirik sskeirik force-pushed the initial-ulm-hook-impl branch from 1c11f3c to cdfa557 Compare December 7, 2024 00:51
@sskeirik sskeirik marked this pull request as ready for review December 7, 2024 01:13

```k
rule <k> PGM:PgmEncoding => . </k>
<entry> FUNCNAME </entry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FUNCNAME does not seem to be used anywhere, so I guess it generates a kompile warning. Could you remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you are using it in the other PR, so I guess it's fine to not remove it. However, the question above about whether the 'entry' cell with $WASM in it is a good idea is still valid.

<k> $PGM:PgmEncoding </k>
<wasm/>
<create> $CREATE:Bool </create>
<entry> $WASM:String </entry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you plan to use this entry cell?

Also, In the "remote" case, my guess is that the $WASM variable will not be set. If that's the case, I'm not sure what it means - will it have a default string value, or will execution fail?


```k
rule <k> PGM:PgmEncoding => . </k>
<entry> FUNCNAME </entry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you are using it in the other PR, so I guess it's fine to not remove it. However, the question above about whether the 'entry' cell with $WASM in it is a good idea is still valid.

<status> Status:Int </status>

rule getGasLeft(_) => #getGasLeft()
rule getOutput(_) => #getOutput()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that this will actually work in ULM, because ULM constructs a getOutput(configuration) term and evaluates it. IIRC, if you have a function f(Something) that uses the configuration (directly or indirectly) with the [[ ... ]] syntax, then kompile transforms it into f(Something, GeneratedTopCell) and silently passes the configuration as an argument. I.e., in the case above, the getOutput function is actually compiled to getOutput(GeneratedTopCell, GeneratedTopCell), which is not what ULM expects.

I might be wrong here, @traiansf for confirmation.

Also see:
https://github.com/Pi-Squared-Inc/ulm/blob/main/kllvm/ulm_kllvm.cpp#L192-L197

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Slack, it's fine to fix this in a follow-up PR.

@sskeirik sskeirik merged commit dd15e21 into master Dec 9, 2024
2 checks passed
@sskeirik sskeirik deleted the initial-ulm-hook-impl branch December 9, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants