Skip to content

Commit e748541

Browse files
committed
feat: simplify Arg in layout, remove the runvmArg and hash cases
1 parent 3985838 commit e748541

File tree

9 files changed

+42
-71
lines changed

9 files changed

+42
-71
lines changed

data/continuation_jump.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,11 @@
514514
{
515515
"type": "simple",
516516
"name": "flags",
517-
"value_types": ["Int"]
517+
"value_types": ["Int"],
518+
"range": {
519+
"min": 0,
520+
"max": 511
521+
}
518522
}
519523
],
520524
"registers": []

examples/golang/tasm-go/spec/spec.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/golang/tasm-go/tasm/decompile.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ func loader(instructions []spec.Instruction) loaderFunc {
294294
args = append(args, StackRegister{idx: 1})
295295
case "minusOne":
296296
args = append(args, -1)
297-
case "hash":
298-
args = append(args, slice.MustLoadUInt(8))
299-
case "runvmArg":
300-
args = append(args, slice.MustLoadUInt(12))
301297
case "refCodeSlice":
302298
val, _ := slice.LoadRefCell()
303299
args = append(args, decompileCell(val))

gen/schema.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,6 @@
457457
{
458458
"$ref": "#/definitions/LargeIntArg"
459459
},
460-
{
461-
"$ref": "#/definitions/RunvmArg"
462-
},
463-
{
464-
"$ref": "#/definitions/HashArg"
465-
},
466460
{
467461
"$ref": "#/definitions/MinusOneArg"
468462
},
@@ -628,28 +622,6 @@
628622
"required": ["$", "range"],
629623
"additionalProperties": false
630624
},
631-
"RunvmArg": {
632-
"type": "object",
633-
"properties": {
634-
"$": {
635-
"type": "string",
636-
"const": "runvmArg"
637-
}
638-
},
639-
"required": ["$"],
640-
"additionalProperties": false
641-
},
642-
"HashArg": {
643-
"type": "object",
644-
"properties": {
645-
"$": {
646-
"type": "string",
647-
"const": "hash"
648-
}
649-
},
650-
"required": ["$"],
651-
"additionalProperties": false
652-
},
653625
"MinusOneArg": {
654626
"type": "object",
655627
"properties": {

gen/tvm-specification.json

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11117,7 +11117,11 @@
1111711117
{
1111811118
"type": "simple",
1111911119
"name": "flags",
11120-
"value_types": ["Int"]
11120+
"value_types": ["Int"],
11121+
"range": {
11122+
"min": 0,
11123+
"max": 511
11124+
}
1112111125
}
1112211126
],
1112311127
"registers": []
@@ -61271,7 +61275,12 @@
6127161275
"$": "simpleArgs",
6127261276
"children": [
6127361277
{
61274-
"$": "runvmArg"
61278+
"$": "uint",
61279+
"len": 12,
61280+
"range": {
61281+
"min": "0",
61282+
"max": "511"
61283+
}
6127561284
}
6127661285
]
6127761286
},
@@ -64647,7 +64656,12 @@
6464764656
"$": "simpleArgs",
6464864657
"children": [
6464964658
{
64650-
"$": "hash"
64659+
"$": "uint",
64660+
"len": 8,
64661+
"range": {
64662+
"min": "0",
64663+
"max": "4"
64664+
}
6465164665
}
6465264666
]
6465364667
},
@@ -64725,7 +64739,12 @@
6472564739
"$": "simpleArgs",
6472664740
"children": [
6472764741
{
64728-
"$": "hash"
64742+
"$": "uint",
64743+
"len": 8,
64744+
"range": {
64745+
"min": "0",
64746+
"max": "4"
64747+
}
6472964748
}
6473064749
]
6473164750
},
@@ -64803,7 +64822,12 @@
6480364822
"$": "simpleArgs",
6480464823
"children": [
6480564824
{
64806-
"$": "hash"
64825+
"$": "uint",
64826+
"len": 8,
64827+
"range": {
64828+
"min": "0",
64829+
"max": "4"
64830+
}
6480764831
}
6480864832
]
6480964833
},
@@ -64886,7 +64910,12 @@
6488664910
"$": "simpleArgs",
6488764911
"children": [
6488864912
{
64889-
"$": "hash"
64913+
"$": "uint",
64914+
"len": 8,
64915+
"range": {
64916+
"min": "0",
64917+
"max": "4"
64918+
}
6489064919
}
6489164920
]
6489264921
},

src/instructions/instructions.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export type arg =
77
| plduzArg
88
| tinyInt
99
| largeInt
10-
| runvmArg
11-
| hash
1210
| minusOne
1311
| s1
1412
| setcpArg
@@ -62,12 +60,6 @@ export const s1: s1 = {$: "s1"}
6260
export type minusOne = {$: "minusOne"}
6361
export const minusOne: minusOne = {$: "minusOne"}
6462

65-
export type runvmArg = {$: "runvmArg"}
66-
export const runvmArg: runvmArg = {$: "runvmArg"}
67-
68-
export type hash = {$: "hash"}
69-
export const hash: hash = {$: "hash"}
70-
7163
// special case: [-15, 239]
7264
export type setcpArg = {$: "setcpArg", range: range}
7365
export const setcpArg: setcpArg = {$: "setcpArg", range: range(-15n, 239n)}
@@ -565,6 +557,7 @@ const uint7 = uint(7, uint7range)
565557
const uint8 = uint(8, uint8range)
566558
const uint11 = uint(11, uint11range)
567559
const uint14 = uint(14, uint14range)
560+
const hash = uint(8, {min: 0n, max: 4n})
568561

569562
export const instructions: Record<string, Opcode> = {
570563
PUSHNAN: cat("int_const", mksimple(0x83ff, 16, `exec_push_nan`)),
@@ -1368,7 +1361,7 @@ export const instructions: Record<string, Opcode> = {
13681361
SAVEALTCTR: cat("continuation_change", mkfixedrangen(0xedb0, 0xedb8, 16, 4, seq(control), `exec_savealt_ctr`)),
13691362
SAVEBOTHCTR: cat("continuation_change", mkfixedrangen(0xedc0, 0xedc8, 16, 4, seq(control), `exec_saveboth_ctr`)),
13701363

1371-
RUNVM: version(4, cat("continuation_jump", mkfixedn(0xdb4, 12, 12, seq(runvmArg), `exec_runvm`))),
1364+
RUNVM: version(4, cat("continuation_jump", mkfixedn(0xdb4, 12, 12, seq(uint(12, {min: 0n, max: 511n})), `exec_runvm`))),
13721365

13731366
// special case: numeric
13741367
"2SWAP": cat("stack", mksimple(0x5a, 8, `exec_2swap`)),

src/instructions/tlb.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ export function generateTlb(
127127
result += `${name}: ^Cell `
128128
break
129129
}
130-
case "runvmArg": {
131-
result += "flags: (## 12)"
132-
break
133-
}
134130
case "delta": {
135131
generateArg(arg.arg)
136132
break
@@ -147,11 +143,6 @@ export function generateTlb(
147143
result += "len: (## 5) data: (int (8 * l + 19))"
148144
break
149145
}
150-
case "hash": {
151-
const name = variableNameGenerator() ?? "i"
152-
result += `${name}: (## 8)`
153-
break
154-
}
155146
case "minusOne": {
156147
const name = variableNameGenerator()
157148
result += `${name}: (## 4) `

src/types/specification-schema.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@ export type Arg =
403403
| PlduzArg
404404
| TinyIntArg
405405
| LargeIntArg
406-
| RunvmArg
407-
| HashArg
408406
| MinusOneArg
409407
| S1Arg
410408
| SetcpArg
@@ -488,14 +486,6 @@ export interface LargeIntArg {
488486
range: ArgRange
489487
}
490488

491-
export interface RunvmArg {
492-
$: "runvmArg"
493-
}
494-
495-
export interface HashArg {
496-
$: "hash"
497-
}
498-
499489
export interface MinusOneArg {
500490
$: "minusOne"
501491
}

validity/input-instr-signature.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ const generateArg = (arg: arg): string => {
9090
return `boc{${DEFAULT_CODE_SLICE}}`
9191
case "slice":
9292
return DEFAULT_SLICE
93-
case "hash":
94-
return "1"
9593
case "s1":
9694
return "s1"
9795
case "plduzArg":

0 commit comments

Comments
 (0)