aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2017-09-08 18:47:44 +0800
committerMartin Holst Swende <martin@swende.se>2017-09-08 18:47:44 +0800
commitd6681ed36037c48bc95c7940e9914b9369e35170 (patch)
tree40af9cfdf8dcfc18a257ea7311d28ca5e1a9524b /core
parent54b1de67e2cbe700a4086d33b10501578dbeaaaf (diff)
downloadgo-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar.gz
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar.bz2
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar.lz
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar.xz
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.tar.zst
go-tangerine-d6681ed36037c48bc95c7940e9914b9369e35170.zip
core/vm: Rename + updated doc on jumpdest analysis
Diffstat (limited to 'core')
-rw-r--r--core/vm/analysis.go8
-rw-r--r--core/vm/analysis_test.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/core/vm/analysis.go b/core/vm/analysis.go
index 08415fc1e..e6a2df7b0 100644
--- a/core/vm/analysis.go
+++ b/core/vm/analysis.go
@@ -38,7 +38,7 @@ func (d destinations) has(codehash common.Hash, code []byte, dest *big.Int) bool
m, analysed := d[codehash]
if !analysed {
- m = jumpdests(code)
+ m = codeBitmap(code)
d[codehash] = m
}
return OpCode(code[udest]) == JUMPDEST && m.codeSegment(udest)
@@ -61,9 +61,9 @@ func (bits *bitvec) codeSegment(pos uint64) bool {
return ((*bits)[pos/8] & (0x80 >> (pos % 8))) == 0
}
-// jumpdests creates a map that contains an entry for each
-// PC location that is a JUMPDEST instruction.
-func jumpdests(code []byte) []byte {
+// jumpdests creates a bitmap of the code, where 1 represents a DATA-segment,
+// and 0 represents code-segment
+func codeBitmap(code []byte) []byte {
//The map is 4 bytes longer than necessary, in case the code
// ends with a PUSH32, the algorithm will push zeroes onto the
// bitvector outside the bounds of the actual code.
diff --git a/core/vm/analysis_test.go b/core/vm/analysis_test.go
index 17c578e95..3d4e709db 100644
--- a/core/vm/analysis_test.go
+++ b/core/vm/analysis_test.go
@@ -28,7 +28,7 @@ func TestJumpDestAnalysis(t *testing.T) {
{[]byte{byte(PUSH32)}, 0xFF, 2},
}
for _, test := range tests {
- ret := jumpdests(test.code)
+ ret := codeBitmap(test.code)
if ret[test.which] != test.exp {
t.Fatalf("expected %x, got %02x", test.exp, ret[test.which])
}