-
Notifications
You must be signed in to change notification settings - Fork 1
Added Anan-AS PVM Interpreter #716
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
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
e891f0c
pvm inteface
DrEverr 56c9a0a
Merge branch 'main' into maso-ananas
DrEverr 97dba6c
run ananas without setting registers and memory
DrEverr 694cd02
setting registers
DrEverr 6016207
Merge branch 'main' into maso-ananas
DrEverr e47732c
adding store and load
DrEverr b38deac
Merge branch 'main' into maso-ananas
DrEverr c9923ef
qa fix
DrEverr 25370fb
invalid memory set
DrEverr 75eeec5
added flat to start ananas interpreter
DrEverr 19a81f5
reset ananas and print program code
DrEverr bd7df0f
Make sure it runs.
tomusdrw e44bc4c
sub and set gas
DrEverr f722af8
qa-fix
DrEverr 8e14d7b
Merge branch 'main' into maso-ananas
DrEverr fefabe4
added ananasAPI, cleaned common methods between interpreters
DrEverr 8538ff4
added interface without memory interface
DrEverr 9a265aa
Merge branch 'main' into maso-ananas
DrEverr c7aa7e4
add memory interface; applied IMemory for build in interpreter
DrEverr 6839ce7
using new gas in HCs
DrEverr faa4353
rename IMemory methods to set and get; implement them
DrEverr ec61330
merge
DrEverr 22afec3
rename pvminterpreter default to buildin
DrEverr 53af23e
Merge branch 'main' into maso-ananas
DrEverr dc9144c
added set all to IRegisters; using IHostCallRegisters in host calls
DrEverr 1a1c1fe
Merge branch 'maso-ananas' of github.com:FluffyLabs/typeberry into ma…
DrEverr c8d57a1
Merge branch 'main' into maso-ananas
DrEverr 0b0cc0c
changed interpreter option name to backend name (more general)
DrEverr d439138
explicitly declare what backend to run on accumulation
DrEverr cdff0aa
fix sub gas
DrEverr 964e9c9
throws error on incorrect pvm flag
DrEverr 6a9582a
Update packages/core/pvm-host-calls/host-call-memory.ts
DrEverr cdde06d
apply suggestions
DrEverr 3548d12
merge
DrEverr 40eebd1
changed HCRegisters to accept buffer
DrEverr 8e3dab3
applied suggestions
DrEverr b04d8c9
added tests and async create instanca manager
DrEverr 5532dea
added hc store load tests
DrEverr 089c364
instanciate built in without async
DrEverr 6ce4980
fixed gas in tb interpreter:
DrEverr c447ca2
disable both pvms accumulation
DrEverr 9c07e2b
wraping memory address in hcMemory; simplify codec for pvmBacked
DrEverr f4f5b0f
implement newest ananas memory api
DrEverr f3ea303
added ananas to external dependency
DrEverr 24d86eb
correctly display default pvm in help
DrEverr ffbf671
moved pvm backend to separate config file
DrEverr d874c6c
fixed log
DrEverr 26ece95
fixed test names
DrEverr a5d4d25
self review
DrEverr 7280a49
Remove API.
tomusdrw 4f46cd2
Remove redundant interfaces.
tomusdrw c6d55ee
Remove dependency on pvm-interpreter.
tomusdrw 045262f
Code review fix.
tomusdrw 1a12752
Separate runners for w3f accumulate.
tomusdrw 522ebcc
Update packages readme.
tomusdrw 781f60c
Add warnings about WASM inlining.
tomusdrw b37c58b
Fix tests.
tomusdrw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,48 @@ | ||
| // biome-ignore-all lint/suspicious/noConsole: bin file | ||
|
|
||
| import { Interpreter, tryAsGas } from "@typeberry/pvm-interpreter"; | ||
| import { Status } from "@typeberry/pvm-interpreter/status.js"; | ||
|
|
||
| const pvm = new Interpreter(); | ||
| import { Status, tryAsGas } from "@typeberry/pvm-interface"; | ||
| import { Interpreter } from "@typeberry/pvm-interpreter"; | ||
| import { AnanasInterpreter } from "@typeberry/pvm-interpreter-ananas"; | ||
|
|
||
| const program = new Uint8Array([ | ||
| 0, 0, 35, 173, 101, 126, 173, 255, 239, 101, 101, 101, 101, 101, 194, 101, 101, 101, 174, 120, 44, 0, 0, 0, 0, 178, | ||
| 230, 174, 73, 44, 0, 0, 0, 0, 178, 230, 174, 120, 73, 85, 65, 2, 4, | ||
| ]); | ||
| pvm.reset(program, 0, tryAsGas(200n)); | ||
| const instructions = pvm.printProgram(); | ||
|
|
||
| const pvmTb = new Interpreter({ useSbrkGas: true }); | ||
| const pvmAnanas = await AnanasInterpreter.new(); | ||
|
|
||
| pvmTb.resetGeneric(program, 0, tryAsGas(200n)); | ||
| pvmAnanas.resetGeneric(program, 0, tryAsGas(200n)); | ||
|
|
||
| const instructions = pvmTb.printProgram(); | ||
|
|
||
| let i = 0; | ||
| while (pvm.nextStep() === Status.OK) { | ||
| let ananas = pvmAnanas.nextStep(); | ||
| let tb = Status.OK; | ||
|
|
||
| while (ananas || tb === Status.OK) { | ||
| console.info(`Instruction ${i}: ${instructions[i]}`); | ||
| console.info(`Registers: ${pvm.getRegisters().getAllU64()}`); | ||
| console.info(`Status: ${pvm.getStatus()}`); | ||
| console.info(`Gas: ${pvm.getGas()}`); | ||
| console.info(`Gas: ${pvm.getPC()}`); | ||
| console.info(`🫐 Registers: ${pvmTb.registers.getAllU64()}`); | ||
| console.info(`🍍 Registers: ${pvmAnanas.registers.getAllU64()}`); | ||
| console.info(`Status: 🫐 ${pvmTb.getStatus()} | 🍍 ${pvmAnanas.getStatus()}`); | ||
| console.info(`Gas: 🫐 ${pvmTb.gas.get()}| 🍍 ${pvmAnanas.gas.get()}`); | ||
| console.info(`PC: 🫐 ${pvmTb.getPC()} | 🍍 ${pvmAnanas.getPC()}`); | ||
| console.info(); | ||
| i++; | ||
| if (tb === Status.OK) { | ||
| tb = pvmTb.nextStep(); | ||
| } | ||
| if (ananas) { | ||
| ananas = pvmAnanas.nextStep(); | ||
| } | ||
| } | ||
|
|
||
| console.info(`Instruction ${i}: ${instructions[i]}`); | ||
| console.info(`Registers: ${pvm.getRegisters().getAllU64()}`); | ||
| console.info(`Status: ${pvm.getStatus()}`); | ||
| console.info(`Gas: ${pvm.getGas()}`); | ||
| console.info(`Gas: ${pvm.getPC()}`); | ||
| console.info(`🫐 Registers: ${pvmTb.registers.getAllU64()}`); | ||
| console.info(`🍍 Registers: ${pvmAnanas.registers.getAllU64()}`); | ||
| console.info(`Status: 🫐 ${pvmTb.getStatus()} | 🍍 ${pvmAnanas.getStatus()}`); | ||
| // TODO [MaSo] Check why they not finished with same gas. | ||
| console.info(`Gas: 🫐 ${pvmTb.gas.get()}| 🍍 ${pvmAnanas.gas.get()}`); | ||
| console.info(`PC: 🫐 ${pvmTb.getPC()} | 🍍 ${pvmAnanas.getPC()}`); | ||
| console.info(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.