Upgrade dependent version: github.com/open-policy-agent/opa (#5315)

Upgrade dependent version: github.com/open-policy-agent/opa v0.18.0 -> v0.45.0

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
hongzhouzi
2022-10-31 10:58:55 +08:00
committed by GitHub
parent 668fca1773
commit ef03b1e3df
363 changed files with 277341 additions and 13544 deletions

View File

@@ -9,7 +9,12 @@ import (
"github.com/open-policy-agent/opa/internal/wasm/types"
)
// Unreachable reprsents an unreachable opcode.
// !!! If you find yourself adding support for more control
// instructions (br_table, if, ...), please adapt the
// `withControlInstr` functions of
// `compiler/wasm/optimizations.go`
// Unreachable represents a WASM unreachable instruction.
type Unreachable struct {
NoImmediateArgs
}
@@ -51,6 +56,29 @@ func (i Block) Instructions() []Instruction {
return i.Instrs
}
// If represents a WASM if instruction.
// NOTE(sr): we only use if with one branch so far!
type If struct {
NoImmediateArgs
Type *types.ValueType
Instrs []Instruction
}
// Op returns the opcode of the instruction.
func (If) Op() opcode.Opcode {
return opcode.If
}
// BlockType returns the type of the if's THEN branch.
func (i If) BlockType() *types.ValueType {
return i.Type
}
// Instructions represents the instructions contained in the if's THEN branch.
func (i If) Instructions() []Instruction {
return i.Instrs
}
// Loop represents a WASM loop instruction.
type Loop struct {
NoImmediateArgs
@@ -118,6 +146,22 @@ func (i Call) ImmediateArgs() []interface{} {
return []interface{}{i.Index}
}
// CallIndirect represents a WASM call_indirect instruction.
type CallIndirect struct {
Index uint32 // type index
Reserved byte // zero for now
}
// Op returns the opcode of the instruction.
func (CallIndirect) Op() opcode.Opcode {
return opcode.CallIndirect
}
// ImmediateArgs returns the function index.
func (i CallIndirect) ImmediateArgs() []interface{} {
return []interface{}{i.Index, i.Reserved}
}
// Return represents a WASM return instruction.
type Return struct {
NoImmediateArgs

View File

@@ -137,3 +137,63 @@ type I32LeS struct {
func (I32LeS) Op() opcode.Opcode {
return opcode.I32LeS
}
// I32Add represents the WASM i32.add instruction.
type I32Add struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (I32Add) Op() opcode.Opcode {
return opcode.I32Add
}
// I64Add represents the WASM i64.add instruction.
type I64Add struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (I64Add) Op() opcode.Opcode {
return opcode.I64Add
}
// F32Add represents the WASM f32.add instruction.
type F32Add struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (F32Add) Op() opcode.Opcode {
return opcode.F32Add
}
// F64Add represents the WASM f64.add instruction.
type F64Add struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (F64Add) Op() opcode.Opcode {
return opcode.F64Add
}
// I32Mul represents the WASM i32.mul instruction.
type I32Mul struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (I32Mul) Op() opcode.Opcode {
return opcode.I32Mul
}
// I32Sub represents the WASM i32.sub instruction.
type I32Sub struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (I32Sub) Op() opcode.Opcode {
return opcode.I32Sub
}

View File

@@ -0,0 +1,29 @@
// Copyright 2021 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package instruction
import (
"github.com/open-policy-agent/opa/internal/wasm/opcode"
)
// Drop reprsents a WASM drop instruction.
type Drop struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (Drop) Op() opcode.Opcode {
return opcode.Drop
}
// Select reprsents a WASM select instruction.
type Select struct {
NoImmediateArgs
}
// Op returns the opcode of the instruction.
func (Select) Op() opcode.Opcode {
return opcode.Select
}

View File

@@ -36,3 +36,19 @@ func (SetLocal) Op() opcode.Opcode {
func (i SetLocal) ImmediateArgs() []interface{} {
return []interface{}{i.Index}
}
// TeeLocal represents the WASM tee_local instruction.
type TeeLocal struct {
Index uint32
}
// Op returns the opcode of the instruction.
func (TeeLocal) Op() opcode.Opcode {
return opcode.TeeLocal
}
// ImmediateArgs returns the index of the local variable to "tee" with the top of
// the stack (like set, but retaining the top of the stack).
func (i TeeLocal) ImmediateArgs() []interface{} {
return []interface{}{i.Index}
}