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

IDL Variant decoding: Make use of type description ACT-111 #697

Merged
merged 3 commits into from
Sep 27, 2019

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Sep 27, 2019

No description provided.

@nomeata nomeata added the automerge-squash When ready, merge (using squash) label Sep 27, 2019
@nomeata nomeata requested a review from ggreif September 27, 2019 13:25
@nomeata nomeata force-pushed the joachim/idl-variant branch from 6fb32a4 to 7e2cf58 Compare September 27, 2019 13:56
Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

Looks good. Maybe we can revisit this later.

@@ -3989,24 +3989,36 @@ module Serialization = struct
)
| Variant vs ->
with_composite_typ (-21l) (fun get_typ_buf ->
ReadBuf.read_leb128 env get_typ_buf ^^ G.i Drop ^^
(* Find the tag *)
let (set_n, get_n) = new_local env "len" in
Copy link
Contributor

Choose a reason for hiding this comment

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

n or "len", not clear.

E.else_trap_with env "IDL error: variant index out of bounds" ^^

(* Zoom past the previous entries *)
get_tagidx ^^ from_0_to_n env (fun _ ->
ReadBuf.read_leb128 env get_typ_buf ^^ G.i Drop ^^
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not call the C-rts internal routine to advance over (s)leb128 in buffer? It would need to get exposed, and it is not yet merged to main. But it could potentially avoid allocation of BigInts (hashes are big).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I thought about doing that, not sure why I didn’t. Let me do a PR right away.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, we have to wait for #687 to do that.

Copy link
Contributor

@ggreif ggreif Sep 28, 2019

Choose a reason for hiding this comment

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

Above:

and it is not yet merged to main

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, didn’t read carefully, my fault.

@mergify mergify bot merged commit 3b1172c into master Sep 27, 2019
@mergify mergify bot deleted the joachim/idl-variant branch September 27, 2019 22:23
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Sep 27, 2019
dfinity-bot added a commit that referenced this pull request Mar 5, 2025
## Changelog for motoko-base:
Branch: next-moc
Commits: [dfinity/motoko-base@8fd23fa7...a3dd04eb](dfinity/motoko-base@8fd23fa...a3dd04e)

* [`cee15564`](dfinity/motoko-base@cee1556) feat: add `isReplicated` to `ExperimentalInternetComputer` ([dfinity/motoko-base⁠#694](https://togithub.com/dfinity/motoko-base/issues/694))
* [`c9a08167`](dfinity/motoko-base@c9a0816) feat: add `Error.isRetryPossible`, a predicate for non-fatal messaging errors ([dfinity/motoko-base⁠#692](https://togithub.com/dfinity/motoko-base/issues/692))
* [`6246b654`](dfinity/motoko-base@6246b65) feat: make `replyDeadline` an optional return type ([dfinity/motoko-base⁠#693](https://togithub.com/dfinity/motoko-base/issues/693))
* [`1a381b99`](dfinity/motoko-base@1a381b9) Motoko 0.14.3
* [`756855bc`](dfinity/motoko-base@756855b) chore: amend the 0.14.3 changelog ([dfinity/motoko-base⁠#697](https://togithub.com/dfinity/motoko-base/issues/697))
mergify bot pushed a commit that referenced this pull request Mar 6, 2025
## Changelog for motoko-base:
Branch: next-moc
Commits: [dfinity/motoko-base@8fd23fa7...a3dd04eb](dfinity/motoko-base@8fd23fa...a3dd04e)

* [`cee15564`](dfinity/motoko-base@cee1556) feat: add `isReplicated` to `ExperimentalInternetComputer` ([dfinity/motoko-base⁠#694](https://togithub.com/dfinity/motoko-base/issues/694))
* [`c9a08167`](dfinity/motoko-base@c9a0816) feat: add `Error.isRetryPossible`, a predicate for non-fatal messaging errors ([dfinity/motoko-base⁠#692](https://togithub.com/dfinity/motoko-base/issues/692))
* [`6246b654`](dfinity/motoko-base@6246b65) feat: make `replyDeadline` an optional return type ([dfinity/motoko-base⁠#693](https://togithub.com/dfinity/motoko-base/issues/693))
* [`1a381b99`](dfinity/motoko-base@1a381b9) Motoko 0.14.3
* [`756855bc`](dfinity/motoko-base@756855b) chore: amend the 0.14.3 changelog ([dfinity/motoko-base⁠#697](https://togithub.com/dfinity/motoko-base/issues/697))
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