Skip to content

Commit

Permalink
Add operand internal flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hacker-volodya committed Feb 26, 2024
1 parent 53d21cf commit c95388c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ However, nothing can stop you from just copying `cp0.json` (and `schema.json` if
| bytecode.operands[i].name | Operand variable name. Allowed chars are `a-zA-Z0-9_`, must not begin with digit or underscore and must not end with underscore. Required.
| bytecode.operands[i].loader | Loader function for operand. Must be one of `int`, `uint`, `ref`, `pushint_long`, `subslice`. Loaders are described below. Required.
| bytecode.operands[i].loader_args | Arguments for loader function, specified below. Optional, no arguments in case of absence.
| bytecode.operands[i].internal | Internal flag. If true, this operand is used as a subslice length variable, should be used only for serialization/deserialization, humans and implementations do not need them. Optional, default is false.
| value_flow | Information related to usage of stack and registers by instruction. Optional.
| value_flow.doc_stack | Free-form description of stack inputs and outputs. Usually the form is `[inputs] - [outputs]` where `[inputs]` are consumed stack values and `outputs` are produced stack values (top of stack is the last value). Optional.
| value_flow.inputs | Incoming values constraints. Input is unconstrained if absent.
Expand Down Expand Up @@ -212,14 +213,16 @@ Special loader which currently is used only in `PUSHINT_LONG` instruction. Loads
"loader": "uint",
"loader_args": {
"size": 2
}
},
"internal": true
},
{
"name": "x",
"loader": "uint",
"loader_args": {
"size": 5
}
},
"internal": true
},
{
"name": "slice",
Expand All @@ -235,7 +238,7 @@ Special loader which currently is used only in `PUSHINT_LONG` instruction. Loads
]
```

Loads subslice of bit length `{bits_length_var} * 8 + bits_padding` and ref count `{refs_length_var} + refs_add`. If `completion_tag` argument with value `true` is passed, remove completion tag from bitstring (trailing `'1' + '0' * x`).
Loads subslice of bit length `{bits_length_var} * 8 + bits_padding` and ref count `{refs_length_var} + refs_add`. If `completion_tag` argument with value `true` is passed, remove completion tag from bitstring (trailing `'1' + '0' * x`). Length variables are usually `"internal": true` because they should not be showed to user or provided to an implementation.

| Argument | Description
| -------- | -----------
Expand Down
39 changes: 26 additions & 13 deletions cp0.json
Original file line number Diff line number Diff line change
Expand Up @@ -3305,7 +3305,8 @@
"loader": "uint",
"loader_args": {
"size": 4
}
},
"internal": true
},
{
"name": "s",
Expand Down Expand Up @@ -3352,14 +3353,16 @@
"loader": "uint",
"loader_args": {
"size": 2
}
},
"internal": true
},
{
"name": "x",
"loader": "uint",
"loader_args": {
"size": 5
}
},
"internal": true
},
{
"name": "slice",
Expand Down Expand Up @@ -3423,14 +3426,16 @@
"loader": "uint",
"loader_args": {
"size": 3
}
},
"internal": true
},
{
"name": "x",
"loader": "uint",
"loader_args": {
"size": 7
}
},
"internal": true
},
{
"name": "slice",
Expand Down Expand Up @@ -3478,14 +3483,16 @@
"loader": "uint",
"loader_args": {
"size": 2
}
},
"internal": true
},
{
"name": "x",
"loader": "uint",
"loader_args": {
"size": 7
}
},
"internal": true
},
{
"name": "s",
Expand Down Expand Up @@ -3538,7 +3545,8 @@
"loader": "uint",
"loader_args": {
"size": 4
}
},
"internal": true
},
{
"name": "s",
Expand Down Expand Up @@ -19073,14 +19081,16 @@
"loader": "uint",
"loader_args": {
"size": 2
}
},
"internal": true
},
{
"name": "y",
"loader": "uint",
"loader_args": {
"size": 3
}
},
"internal": true
},
{
"name": "sss",
Expand Down Expand Up @@ -21152,7 +21162,8 @@
"loader": "uint",
"loader_args": {
"size": 7
}
},
"internal": true
},
{
"name": "s",
Expand Down Expand Up @@ -21205,7 +21216,8 @@
"loader": "uint",
"loader_args": {
"size": 7
}
},
"internal": true
},
{
"name": "s",
Expand Down Expand Up @@ -43102,7 +43114,8 @@
"loader": "uint",
"loader_args": {
"size": 4
}
},
"internal": true
},
{
"name": "s",
Expand Down
6 changes: 6 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,12 @@
"type": "object",
"title": "Arguments for loader function. Optional, no arguments in case of absence.",
"default": {}
},
"internal": {
"type": "boolean",
"title": "Internal flag",
"description": "If true, this operand is used as a subslice length variable, should be used only for serialization/deserialization, humans and implementations do not need them.",
"default": false
}
},
"required": [
Expand Down

0 comments on commit c95388c

Please sign in to comment.