mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Support basic DCE and build tags in the compiler #979
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#979
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fyrchik on GitHub (Sep 2, 2022).
There are 2 cases for the build tags:
Notaryis enabled or disabled. This makes our contracts bigger, it would be nice to have the same code base and specify what we need during compilation.debugLogfunction declared non empty and removed from the release version.I am hoping this could be done without touching compiler at all, this is just about the files we want to include.
As a consequence, it would be nice to support 2 basic DCE cases:
if debug { }).I don't want to complicate our compiler, but these cases (at least the second) seems simple enough.
@roman-khimov commented on GitHub (Sep 2, 2022):
Do we have build tags anywhere in the package data? Do we want to parse comments? Constant conditions seem to be simple enough to try optimizing them, but conditional compilation (hi
#ifdef) for contracts in Go? SCs are relatively simple and they should be simple enough for audit.@fyrchik commented on GitHub (Sep 2, 2022):
Part of the task is to figure it out, but it seems like we could just pass through the build flags to the go command https://github.com/golang/tools/blob/master/go/packages/packages_test.go#L497
I see your point, but IMO code can be simpler with build tags: for every single scenario (with/without notary) you can see what is actually compiled and used. Also
go:buildisn't comparable to#ifdefin terms of possible complexity, because tags can only be provided on a per-file basis.