github.com/neatio-net/neatio@v1.7.3-0.20231114194659-f4d7a2226baa/chain/core/vm/memory_table.go (about)

     1  package vm
     2  
     3  func memorySha3(stack *Stack) (uint64, bool) {
     4  	return calcMemSize64(stack.Back(0), stack.Back(1))
     5  }
     6  
     7  func memoryCallDataCopy(stack *Stack) (uint64, bool) {
     8  	return calcMemSize64(stack.Back(0), stack.Back(2))
     9  }
    10  
    11  func memoryReturnDataCopy(stack *Stack) (uint64, bool) {
    12  	return calcMemSize64(stack.Back(0), stack.Back(2))
    13  }
    14  
    15  func memoryCodeCopy(stack *Stack) (uint64, bool) {
    16  	return calcMemSize64(stack.Back(0), stack.Back(2))
    17  }
    18  
    19  func memoryExtCodeCopy(stack *Stack) (uint64, bool) {
    20  	return calcMemSize64(stack.Back(1), stack.Back(3))
    21  }
    22  
    23  func memoryMLoad(stack *Stack) (uint64, bool) {
    24  	return calcMemSize64WithUint(stack.Back(0), 32)
    25  }
    26  
    27  func memoryMStore8(stack *Stack) (uint64, bool) {
    28  	return calcMemSize64WithUint(stack.Back(0), 1)
    29  }
    30  
    31  func memoryMStore(stack *Stack) (uint64, bool) {
    32  	return calcMemSize64WithUint(stack.Back(0), 32)
    33  }
    34  
    35  func memoryCreate(stack *Stack) (uint64, bool) {
    36  	return calcMemSize64(stack.Back(1), stack.Back(2))
    37  }
    38  
    39  func memoryCreate2(stack *Stack) (uint64, bool) {
    40  	return calcMemSize64(stack.Back(1), stack.Back(2))
    41  }
    42  
    43  func memoryCall(stack *Stack) (uint64, bool) {
    44  	x, overflow := calcMemSize64(stack.Back(5), stack.Back(6))
    45  	if overflow {
    46  		return 0, true
    47  	}
    48  	y, overflow := calcMemSize64(stack.Back(3), stack.Back(4))
    49  	if overflow {
    50  		return 0, true
    51  	}
    52  	if x > y {
    53  		return x, false
    54  	}
    55  	return y, false
    56  }
    57  func memoryDelegateCall(stack *Stack) (uint64, bool) {
    58  	x, overflow := calcMemSize64(stack.Back(4), stack.Back(5))
    59  	if overflow {
    60  		return 0, true
    61  	}
    62  	y, overflow := calcMemSize64(stack.Back(2), stack.Back(3))
    63  	if overflow {
    64  		return 0, true
    65  	}
    66  	if x > y {
    67  		return x, false
    68  	}
    69  	return y, false
    70  }
    71  
    72  func memoryStaticCall(stack *Stack) (uint64, bool) {
    73  	x, overflow := calcMemSize64(stack.Back(4), stack.Back(5))
    74  	if overflow {
    75  		return 0, true
    76  	}
    77  	y, overflow := calcMemSize64(stack.Back(2), stack.Back(3))
    78  	if overflow {
    79  		return 0, true
    80  	}
    81  	if x > y {
    82  		return x, false
    83  	}
    84  	return y, false
    85  }
    86  
    87  func memoryReturn(stack *Stack) (uint64, bool) {
    88  	return calcMemSize64(stack.Back(0), stack.Back(1))
    89  }
    90  
    91  func memoryRevert(stack *Stack) (uint64, bool) {
    92  	return calcMemSize64(stack.Back(0), stack.Back(1))
    93  }
    94  
    95  func memoryLog(stack *Stack) (uint64, bool) {
    96  	return calcMemSize64(stack.Back(0), stack.Back(1))
    97  }