Roman Khimov
92c94f265c
interop/vm: make VM reusable and use on VM for all in-block execs
...
Avoid allocating again and again. Increases TPS by about 3%.
2022-06-07 10:05:47 +03:00
Anna Shaleva
1005c1f7db
vm: forbid jumping out of the script bounds
2022-06-06 12:18:19 +03:00
Roman Khimov
edb6ca8926
Merge pull request #2531 from nspcc-dev/perf
...
Minor performance improvements
2022-06-03 10:40:56 +03:00
Roman Khimov
c3d989ebda
stackitem: reusable serialization context
...
We serialize items a lot and this allows to avoid a number of allocations.
2022-06-02 15:38:39 +03:00
Roman Khimov
3d4076ca36
vm: microoptimize new estack creation
...
Subslice won't reach element -1, but it can reuse the same buffer space more
effectively.
2022-05-31 18:53:05 +03:00
Roman Khimov
e1607e23c2
Merge pull request #2525 from nspcc-dev/immutable-items
...
vm: implement immutable stackitems
2022-05-31 10:36:56 +03:00
Anna Shaleva
42a051e55a
core: DeepCopy notifiction event args inside System.Runtime.Notify
2022-05-31 08:07:53 +03:00
Anna Shaleva
7296f0c913
vm: support immutable compound types
2022-05-31 08:07:50 +03:00
Anna Shaleva
107f5e0793
vm: adjust refcount operations order
...
Perform add/set/remove operations with VM type firstly, and with
refcounter after that. It is needed to be able to extend add/set/remove
operations with extra checks.
2022-05-31 08:02:13 +03:00
Roman Khimov
502cdd68ab
Merge pull request #2508 from nspcc-dev/snapshot-isolation
...
core, vm: implement snapshot isolation
2022-05-27 12:44:06 +03:00
Anna Shaleva
a79c80cb8d
vm: wrap cross-contract exceptions
2022-05-26 11:44:26 +03:00
Anna Shaleva
a39b7cc3fd
core, vm: move all isolation-related logic out of VM
...
Keep it inside the interop context.
2022-05-26 09:26:31 +03:00
Anna Shaleva
f79f62dab4
vm: use single function instead of committer/discarder
2022-05-26 09:26:31 +03:00
Anna Shaleva
08b68e9b82
vm, core: push Null return value only if no exception occurs
...
Close https://github.com/nspcc-dev/neo-go/issues/2509 .
2022-05-26 09:26:31 +03:00
Anna Shaleva
ce226f6b76
vm: optimize context wrapping code
...
We can omit DAO wrapping for safe methods and for those methods that are not
wrapped into try-catch block. However, we still need to persist
notificationsCount changes for these methods to the parent context.
2022-05-26 09:26:31 +03:00
Anna Shaleva
0cd19f550e
core, vm: implement snapshot isolation
...
Initial implementation without optimisations, but it should work.
2022-05-26 09:26:25 +03:00
Anna Shaleva
a3285eae04
vm: stringify InteropInterface stackitem type as InteropInterface
2022-05-25 13:20:21 +03:00
Roman Khimov
ae2395f55f
vm: simplify (slot).Set code
...
Refcounter handles nil items just fine.
2022-05-17 16:26:22 +03:00
Roman Khimov
f2f66ad36e
vm: clear static slot refs on exit, fix #2501
2022-05-17 16:26:22 +03:00
Roman Khimov
0d93b353e6
vm: count initial Null slot variables as well
...
Match C# behavior. Thanks to @ixje for finding this.
2022-05-16 17:42:57 +03:00
Roman Khimov
18d627e7f7
vm: count map key in the refcounter as well
...
Thanks @ixje for spotting this.
2022-05-16 16:07:25 +03:00
Anna Shaleva
e66e82278c
vm: upgrade submodule
2022-05-12 14:25:14 +03:00
Anna Shaleva
a94ccf9236
vm: add MODMUL and MODPOW opcodes
...
Close #2470 .
2022-05-12 14:25:14 +03:00
Roman Khimov
c6f8c33e66
Merge pull request #2478 from nspcc-dev/mainnet-fixes
...
Mainnet fixes
2022-05-12 10:04:53 +03:00
Roman Khimov
621db8c832
stackitem: allow to unJSONize big numbers (>int64), fix #2477
...
100000000000000000000 overflows int64 and NeoGo returns some garbage to
contracts instead of a proper number.
2022-05-11 21:03:10 +03:00
Anna Shaleva
3be37e8c5b
vm: check instruction offset is valid before subsequent IP move
...
Reference implementation:
e167f03e25/src/neo-vm/ExecutionContext.cs (L77)
.
Turns out that exception-related code (try\finally handling) is the only
place where next instruction pointer bounds are not pre-checked before
assignment. This statement is true for both go and C# implementations.
However, C# code has duplicate check located inside the
InstructionPointer setter for all instructions except the
exception-related ones. Neo-go code doesn't perform this duplicate check.
Thus, C# VM FAULTs execution in case of invalid TRY/FINALLY offsets, and
neo-go VM does not.
This commit reverts a part of
https://github.com/nspcc-dev/neo-go/pull/2396 . This bug is discovered
thanks to test added in https://github.com/neo-project/neo-vm/pull/453 .
2022-05-11 14:04:02 +03:00
Anna Shaleva
8af043520d
vm: adjust MaxByteArrayComparableSize value
...
https://github.com/neo-project/neo-vm/pull/454#discussion_r857533800 .
2022-05-07 12:56:09 +03:00
Anna Shaleva
23b78b0be2
vm: limit ByteArray comparable length
...
Close #2460 .
2022-05-07 12:56:04 +03:00
Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Roman Khimov
bf3415e2bc
emit: introduce CheckSig function
...
Which allows to create verification scripts without keys.PublicKey which is
convenient in some cases where we already have serialized key and don't want
to waste time decompressing it.
2022-04-27 22:57:10 +03:00
Anna Shaleva
2972569a0a
vm: make byte representation of VMState compatible with C#
2022-04-04 13:52:29 +03:00
Roman Khimov
ad1dd3ebb7
Merge pull request #2399 from nspcc-dev/fuzz-tests
...
vm: add some Fuzz tests
2022-03-21 12:00:55 +03:00
Evgeniy Stratonikov
3f65473f64
vm: add some Fuzz tests
...
Both `IsScriptCorrect` and `VM.Run` should never panic.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-18 16:13:39 +03:00
Roman Khimov
906d99571b
Merge pull request #2369 from nspcc-dev/goshechka
...
*: go 1.18 support 🎉 😍 🎊 🍰 🥂
2022-03-18 15:07:20 +03:00
Roman Khimov
c2845852ae
Merge pull request #2397 from nspcc-dev/is-script-correct-panic
...
vm: avoid panic in `IsScriptCorrect`
2022-03-18 10:08:39 +03:00
Evgeniy Stratonikov
ef28308dbf
vm: avoid panic in IsScriptCorrect
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 20:12:50 +03:00
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
Evgeniy Stratonikov
492c91b4c5
vm: disallow negative offset in (*Context).Next()
...
Currently the only known reason this can happen is processing
ENDFINALLY opcode before the corresponding ENDTRY.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 18:52:48 +03:00
Roman Khimov
5379ef75bb
Merge pull request #2391 from nspcc-dev/fix-reverse
...
vm: fix integer conversions
2022-03-10 12:27:10 +03:00
Evgeniy Stratonikov
32f4404954
vm: allow HASKEY on byte-arrays
...
Current neo-vm master has them https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/ExecutionEngine.cs#L1157
Were silently added in
029466fa9d
.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-10 10:34:13 +03:00
Evgeniy Stratonikov
39866b8512
vm: fix integer conversions
...
As can be seen in https://dotnetfiddle.net/s7eg21 (int) conversions
result in an exception in C# code.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-10 10:21:34 +03:00
Evgeniy Stratonikov
a8d2df874f
stackitem: limit JSON size in ToJSONWithTypes
...
Also do not limit depth. It was introduced in e34fa2e915
as a simple
solution to OOM problem. In this commit we do exactly the refactoring
described there. Maximum size is the same as stack item size and
can be changed if needed withouth significat refactoring.
`1 MiB` seems sufficient, though.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-09 10:29:23 +03:00
AnnaShaleva
c35950206a
vm: add test to check CLI UTF-8 compatibility
2022-02-18 19:20:50 +03:00
Anna Shaleva
c182141624
vm: fix linter issue
...
printf: `fmt.Fprintln` arg list ends with redundant newline (govet)
2022-02-18 19:20:43 +03:00
Anna Shaleva
2501ce3cb1
vm: adjust run
description for VM CLI
...
With urfave/cli method name can be `help`.
2022-02-18 16:34:58 +03:00
Anna Shaleva
d04d55708c
vm: setup autocompleter
2022-02-18 16:34:58 +03:00
Anna Shaleva
e8ec820d2e
vm: add unload
command
...
When execution fails it's the only way to change the prompt showing the
last executed instruction. Example:
```
NEO-GO-VM > loadgo examples/engine/engine.go
READY: loaded 117 instructions
NEO-GO-VM 0 > run
Error: at instruction 3 (SYSCALL): failed to invoke syscall 805851437: syscall not found
NEO-GO-VM 8 > parse
Error: missing argument
NEO-GO-VM 8 > parse 123
Integer to Hex 7b
Integer to Base64 ew==
String to Hex 313233
String to Base64 MTIz
NEO-GO-VM 8 > unload
NEO-GO-VM > exit
```
2022-02-18 16:34:58 +03:00
Anna Shaleva
563c3a4baa
vm: replace ishell with urfave/cli
...
Use github.com/chzyer/readline for readline capabilities (including
history and ANSI escape sequences handling).
2022-02-18 16:34:50 +03:00
Roman Khimov
075fd05bfc
Merge pull request #2356 from nspcc-dev/rpc-big-numbers
...
Allow to use big integers in RPC
2022-02-11 13:24:35 +03:00
Evgeniy Stratonikov
c72b3f2176
vm/emit: check big integer size
...
Fix a bug where big integer could be emitted as 0 without reporting an
error. Also, add tests.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:55 +03:00
Evgeniy Stratonikov
0394a79ef8
rpc: support big integers as request parameters
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:54 +03:00
Anna Shaleva
a9872063fe
vm: refactor VM CLI tests as they take too long to pass
...
These tests are slow on Windows, so refactor them a bit and avoid the following
error:
```
--- FAIL: TestRunWithDifferentArguments (4.01s)
cli_test.go:96:
Error Trace: cli_test.go:96
cli_test.go:321
Error: command took too long time
Test: TestRunWithDifferentArguments
```
2022-02-10 18:04:16 +03:00
Evgeniy Stratonikov
10d006195a
vm: properly clear try stack in CALL
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-04 11:04:03 +03:00
Evgeniy Stratonikov
ad65d1fa1f
compiler: implement custom logic for go1.15
...
For some reason `foo.go` is interpreted as an http URL, and even if we
replace it with `./foo.go` there is an errors with file missing on disk.
Because `CompileWithOptions` should be able to compile file under any
circumstances, we allocate temporary directory base on version used to
compile a binary.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 17:43:28 +03:00
Evgeniy Stratonikov
25583f9aeb
compiler: make pkg/interop a separate module
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
9871dc8f5a
compiler: update x/tools package
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
e7a0ecb349
compiler: provide .go
filename to Compile
...
First argument contains filename, thus we use '.go' suffix to
distinguish between directories and files.
Contract name should be provided in options.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:24 +03:00
Evgeniy Stratonikov
8af9c870b1
compiler: remove CompileWithDebugInfo
...
It is a simple wrapper over `CompileWithOptions` which we don't really
need. Custom options can be specified explicitly instead of using some
random default. This default was introduced in 1578904da
, however tests
written there use `CompileWithOptions` and all other tests
pass on that commit even without this default.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:15:48 +03:00
Anna Shaleva
0e1f85b2bf
vm: optimise emit.Array() to use NEWARRAY0 for zero-lenght arrays
2022-01-14 17:56:10 +03:00
AnnaShaleva
48355ba9bf
vm: allow to emit int[32, 16, 8] and some of uints
2022-01-13 19:12:20 +03:00
Evgeniy Stratonikov
ffb6504f67
vm: cut trailing spaces in PrintOps
...
When there is a single big instruction (like PUSHDATA4) in script,
all other instructions are padded to the right with spaces.
This makes it hard to view script in terminal, because long lines
are usually wrapped at the screen boundary and printed as multiple lines.
The culprit is our `cursor` field which is printed in the last column
and causes all previous fields to have the same length for every
instruction. One way to fix this is to omit cursor field if it is empty.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-12-28 11:27:31 +03:00
Roman Khimov
299a7ea614
compiler: use CALLT for native contract calls, fix #2257
2021-12-10 11:58:50 +03:00
Roman Khimov
96339e9f64
Merge pull request #2290 from nspcc-dev/microopt
...
Trivial microoptimizations
2021-12-02 19:21:45 +03:00
Roman Khimov
eb27699dad
vm: put child invocation tree nodes into call
element
...
As neo-project/neo-modules#657 currently does.
2021-12-02 17:46:48 +03:00
Roman Khimov
53cfde62de
vm: don't allocate another stack for entry scripts
...
vm.New() creates a new stack, then we load an entry script with
LoadScriptWithFlags and it creates another one which doesn't make much
sense. rvcount is -1 for it, so all elements are to be copied down anyway and
it's clear so a new loaded script can't dig down to anything it shouldn't be
able to.
2021-12-02 15:59:51 +03:00
Roman Khimov
aa1da9de5a
vm: preallocate for istack
...
Avoid growing it in runtime.
2021-12-01 21:36:35 +03:00
Roman Khimov
decff2bfb9
stackitem: simplify extracting value from map
...
Going through interfaces doesn't make it faster.
2021-12-01 21:36:35 +03:00
Roman Khimov
af8a4da6d9
stackitem: use type switch more effectively
...
Reduce the number of allocations, save some time.
name old time/op new time/op delta
EncodeBinary-8 51.2µs ± 8% 44.6µs ± 7% -12.79% (p=0.008 n=5+5)
SerializeSimple-8 523ns ± 5% 449ns ± 4% -14.27% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
EncodeBinary-8 329kB ± 0% 329kB ± 0% -0.12% (p=0.008 n=5+5)
SerializeSimple-8 432B ± 0% 408B ± 0% -5.56% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
EncodeBinary-8 36.0 ± 0% 20.0 ± 0% -44.44% (p=0.008 n=5+5)
SerializeSimple-8 7.00 ± 0% 6.00 ± 0% -14.29% (p=0.008 n=5+5)
2021-12-01 21:36:35 +03:00
Roman Khimov
418ba1dbc3
*: use internal variables for simple big.NewInt() values
...
Avoid additional allocations.
2021-12-01 21:36:25 +03:00
Roman Khimov
3eed9d06f8
stackitem: add some hint to 'seen' maps
...
It's empirical, we usually have one container, but four is likely to fit most
of regular cases.
2021-12-01 21:36:25 +03:00
Roman Khimov
ee05f73b6f
vm: simplify slot and make it private
...
Hiding refcounter inside a slot is actually a good idea, but it makes the
structure somewhat bigger, especially given that the refcounter is the same
and belongs more to VM or Context. New structure is a bit more efficient:
name old time/op new time/op delta
ScriptFibonacci-8 672µs ± 2% 644µs ± 0% -4.15% (p=0.008 n=5+5)
ScriptNestedRefCount-8 1.08ms ± 1% 1.05ms ± 2% -2.56% (p=0.008 n=5+5)
ScriptPushPop/4-8 1.52µs ± 1% 1.47µs ± 1% -3.14% (p=0.008 n=5+5)
ScriptPushPop/16-8 3.66µs ± 1% 3.54µs ± 1% -3.24% (p=0.008 n=5+5)
ScriptPushPop/128-8 24.7µs ± 1% 23.2µs ± 1% -6.14% (p=0.008 n=5+5)
ScriptPushPop/1024-8 183µs ± 1% 173µs ± 1% -5.01% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
ScriptFibonacci-8 114kB ± 0% 114kB ± 0% ~ (p=0.079 n=4+5)
ScriptNestedRefCount-8 241kB ± 0% 241kB ± 0% ~ (p=0.333 n=5+4)
ScriptPushPop/4-8 160B ± 0% 160B ± 0% ~ (all equal)
ScriptPushPop/16-8 640B ± 0% 640B ± 0% ~ (all equal)
ScriptPushPop/128-8 8.70kB ± 0% 8.70kB ± 0% ~ (all equal)
ScriptPushPop/1024-8 73.2kB ± 0% 73.2kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
ScriptFibonacci-8 3.17k ± 0% 3.17k ± 0% -0.03% (p=0.008 n=5+5)
ScriptNestedRefCount-8 10.7k ± 0% 10.7k ± 0% ~ (all equal)
ScriptPushPop/4-8 8.00 ± 0% 8.00 ± 0% ~ (all equal)
ScriptPushPop/16-8 32.0 ± 0% 32.0 ± 0% ~ (all equal)
ScriptPushPop/128-8 259 ± 0% 259 ± 0% ~ (all equal)
ScriptPushPop/1024-8 2.05k ± 0% 2.05k ± 0% ~ (all equal)
It'd be especially nice to internalize static slot, but as we can't compare
slices it's not possible.
2021-12-01 21:36:25 +03:00
Roman Khimov
a0473aca92
Merge pull request #2283 from nspcc-dev/fix-vm-tests
...
vm: fix cli tests
2021-12-01 11:35:41 +03:00
Roman Khimov
01d15ff473
Merge pull request #2270 from nspcc-dev/vm-invoked-contracts
...
Add invoked contract tracing
2021-12-01 11:27:27 +03:00
AnnaShaleva
c67d249a8d
vm: fix cli tests
...
* Remove extra symbols during command execution.
* Fix test contract paths.
2021-12-01 11:14:29 +03:00
AnnaShaleva
aefb6f9fee
*: fix tests failing due to path.Join usage
...
Solution:
Use `file/filepath` package to construct expected path. This package is OS-aware, see https://github.com/golang/go/issues/30616 .
2021-11-29 11:11:09 +03:00
Anna Shaleva
6cdb701a9d
vm: improve error message for (*executor).checkError
...
It is helpful if something goes wrong.
2021-11-29 11:09:39 +03:00
Roman Khimov
c01427ca65
rpc: add verbose parameter to invokefunction and invokescript
2021-11-20 21:57:41 +03:00
Roman Khimov
d01f9da8f3
vm: add invocation tree tracing
2021-11-20 21:57:41 +03:00
Roman Khimov
eb96f5a5a2
vm: drop CheckReturnState definition
...
It's something obsolete from RC phase.
2021-11-20 21:57:41 +03:00
Roman Khimov
b0a8f54776
vm: drop LoadArgs method, it's a Legacy remnant
2021-11-20 21:57:41 +03:00
Roman Khimov
cd3670a199
vm: refactor LoadScript* internals a bit
...
Reduce code duplication, provide a single point where scripts are being loaded
into the VM (and new contexts are created).
2021-11-20 21:57:41 +03:00
Roman Khimov
83d0b2f465
interop: move invocation counter from VM to Context
...
It's created for interop and used by interop, VM doesn't care.
2021-11-20 21:57:41 +03:00
Roman Khimov
29cda5112a
vm: simplify NEF loading by providing a special method
...
Offsets are still handled outside of VM to avoid introducing manifest
dependency (that's likely to be circular).
2021-11-20 21:57:41 +03:00
Roman Khimov
82d2231ea6
vm: make retCount an internal member of Context
...
Doesn't make much sense exposing it, it's only used by vm package itself.
2021-11-20 21:57:41 +03:00
Roman Khimov
c53d978edd
vm: drop ParamCount from Context
...
It's unused and it's useless.
2021-11-20 21:57:41 +03:00
Roman Khimov
765235eca3
vm: omit context parameter from Call()
...
It's not used and should not be used to switch from contract to contract.
2021-11-20 21:57:41 +03:00
Roman Khimov
7b713762be
vm: do not increment invocation counter in Call
...
Everywhere it matters (and that's callExFromNative() now) it's incremented
already, so when we're doing Call() at the same time (and it's done to invoke
`_initialize` method) we're effectively double-incrementing it.
2021-11-20 21:57:41 +03:00
Roman Khimov
a577d40de9
vm: move Jump method to the Context
...
Because it's only relevant for execution context itself.
2021-11-20 21:57:35 +03:00
Roman Khimov
3e6ce3c221
vm: add PACKMAP/PACKSTRUCT, extend UNPACK
...
See neo-project/neo-vm#443 .
2021-11-12 17:19:59 +03:00
Evgeniy Stratonikov
51127b8918
vmcli: convert base64 string to address in parse
...
In application logs hashes are serialized as base64 so it is useful
to convert them back to address via `util convert`.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 14:55:10 +03:00
Anna Shaleva
693c376d21
vm: wait more for a test prog execution ending
2021-10-22 12:14:37 +03:00
Evgeniy Stratonikov
5c470a6e3d
vm: catch out-of-bounds exceptions, fix #2208
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-11 17:28:00 +03:00
Evgeniy Stratonikov
435463e620
vm: allow big string keys in PICKITEM
...
Because `MaxKeySize` is bigger than integer size, we fail on integer
cast while retreiving items from map. SETITEM is not affected.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-11 17:14:28 +03:00
Anna Shaleva
3b04b6d238
vm: refactor stack dump commands
2021-09-09 13:45:10 +03:00
Anna Shaleva
6da458365d
vm CLI: allow to dump slots
2021-09-09 13:45:10 +03:00
Anna Shaleva
913e3878c5
vm CLI: check whether VM is ready before jumping to the instruction
...
It allows to avoid panic:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xdab469]
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Jump(...)
github.com/nspcc-dev/neo-go/pkg/vm/vm.go:1506
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleRun(0xc0005988f0)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:413 +0x2e9
github.com/abiosoft/ishell/v2.(*Shell).handleCommand(0xc0004320f0, {0xc00032c7c0, 0xc0002a3920, 0x0})
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:279 +0x143
github.com/abiosoft/ishell/v2.handleInput(0xc0004320f0, {0xc00032c7c0, 0x3, 0x4})
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:233 +0x31
github.com/abiosoft/ishell/v2.(*Shell).run(0xc0004320f0)
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:212 +0x30f
github.com/abiosoft/ishell/v2.(*Shell).Run(0xc0004320f0)
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:112 +0x28
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000224030)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:538 +0x39
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001f46e0)
github.com/nspcc-dev/neo-go/cli/vm/vm.go:28 +0xb4
github.com/urfave/cli.HandleAction({0xe65fa0, 0x1161c68}, 0x2)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xfed435, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x100576d, 0x19}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001016c0, {0xc0000c6000, 0x2, 0x2})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
./main.go:19 +0x33
```
2021-09-08 17:53:09 +03:00
Anna Shaleva
cbc75afd4d
docs: refactor documentation
...
CLI:
* Typos are fixed
* Documentation on NEP-11 tokens is added
* NeoGo node configuration is moved to a separate file
Compiler:
* Typos and indentations are fixed
* Ops dump example is updated
Consensus:
* Typos are fixed
* Links are fixed
Notifications:
* Minor adjustments
RPC:
* `getversion` response is updated
* `getunclamedgas` comment is removed (not valid since
https://github.com/neo-project/neo-modules/pull/243 )
VM:
* Update help message
* `load*` command adjustments
* `astack` command removal
2021-09-08 17:52:46 +03:00
Roman Khimov
a3892aa662
vm: don't use PushVal when item type is known
...
PushVal is very convenient, but type switch is somewhat expensive.
name old time/op new time/op delta
ScriptFibonacci-8 736µs ± 1% 602µs ± 1% -18.21% (p=0.000 n=9+10)
ScriptNestedRefCount-8 1.08ms ± 2% 0.96ms ± 1% -11.13% (p=0.000 n=10+10)
ScriptPushPop/4-8 1.48µs ± 3% 1.35µs ± 2% -9.14% (p=0.000 n=10+9)
ScriptPushPop/16-8 3.59µs ± 1% 3.38µs ± 1% -6.01% (p=0.000 n=10+10)
ScriptPushPop/128-8 23.7µs ± 1% 22.6µs ± 1% -4.39% (p=0.000 n=10+8)
ScriptPushPop/1024-8 176µs ± 2% 167µs ± 3% -5.24% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
ScriptFibonacci-8 123kB ± 0% 114kB ± 0% -6.88% (p=0.000 n=10+9)
ScriptNestedRefCount-8 266kB ± 0% 241kB ± 0% -9.23% (p=0.000 n=8+10)
ScriptPushPop/4-8 160B ± 0% 160B ± 0% ~ (all equal)
ScriptPushPop/16-8 640B ± 0% 640B ± 0% ~ (all equal)
ScriptPushPop/128-8 8.70kB ± 0% 8.70kB ± 0% ~ (all equal)
ScriptPushPop/1024-8 73.2kB ± 0% 73.2kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
ScriptFibonacci-8 3.53k ± 0% 3.17k ± 0% -9.98% (p=0.000 n=10+10)
ScriptNestedRefCount-8 11.8k ± 0% 10.7k ± 0% -8.70% (p=0.000 n=10+10)
ScriptPushPop/4-8 8.00 ± 0% 8.00 ± 0% ~ (all equal)
ScriptPushPop/16-8 32.0 ± 0% 32.0 ± 0% ~ (all equal)
ScriptPushPop/128-8 259 ± 0% 259 ± 0% ~ (all equal)
ScriptPushPop/1024-8 2.05k ± 0% 2.05k ± 0% ~ (all equal)
2021-08-30 23:43:58 +03:00
Roman Khimov
bc31c97c32
vm: simplify access to context, don't call Context() twice
...
Avoid going through Value(), avoid doing type casts twice for every
instruction.
name old time/op new time/op delta
ScriptFibonacci-8 793µs ± 3% 736µs ± 1% -7.18% (p=0.000 n=10+9)
ScriptNestedRefCount-8 1.09ms ± 1% 1.08ms ± 2% -0.96% (p=0.035 n=10+10)
ScriptPushPop/4-8 1.51µs ± 3% 1.48µs ± 3% ~ (p=0.072 n=10+10)
ScriptPushPop/16-8 3.76µs ± 1% 3.59µs ± 1% -4.56% (p=0.000 n=10+10)
ScriptPushPop/128-8 25.0µs ± 1% 23.7µs ± 1% -5.28% (p=0.000 n=10+10)
ScriptPushPop/1024-8 184µs ± 1% 176µs ± 2% -4.22% (p=0.000 n=9+9)
2021-08-30 23:43:58 +03:00
Roman Khimov
e09a0f3969
vm: don't allocate for break points in NewContext
...
They're rarely used and when they're used they're appended to.
2021-08-29 13:15:12 +03:00