mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: implement OSLICESTR
Add a new function and generic operation to handle bounds checking for slices. Unlike the index bounds checking the index can be equal to the upper bound. Do gc-friendly slicing that generates proper code for 0-length result slices. This is a takeover of Alexandru's original change, (https://go-review.googlesource.com/#/c/12764/) submittable now that the decompose phase is in. Change-Id: I17d164cf42ed7839f84ca949c6ad3289269c9160 Reviewed-on: https://go-review.googlesource.com/13903 Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
8e601b23cd
commit
3526cf586b
6 changed files with 234 additions and 4 deletions
|
|
@ -21,9 +21,11 @@ var genericOps = []opData{
|
|||
{name: "Sub16"},
|
||||
{name: "Sub32"},
|
||||
{name: "Sub64"},
|
||||
{name: "SubPtr"},
|
||||
{name: "Sub32F"},
|
||||
{name: "Sub64F"},
|
||||
// TODO: Sub64C, Sub128C
|
||||
// TODO: Sub32F, Sub64F, Sub64C, Sub128C
|
||||
|
||||
{name: "Mul8"}, // arg0 * arg1
|
||||
{name: "Mul16"},
|
||||
|
|
@ -311,8 +313,9 @@ var genericOps = []opData{
|
|||
{name: "Cvt64Fto32F"},
|
||||
|
||||
// Automatically inserted safety checks
|
||||
{name: "IsNonNil"}, // arg0 != nil
|
||||
{name: "IsInBounds"}, // 0 <= arg0 < arg1
|
||||
{name: "IsNonNil"}, // arg0 != nil
|
||||
{name: "IsInBounds"}, // 0 <= arg0 < arg1
|
||||
{name: "IsSliceInBounds"}, // 0 <= arg0 <= arg1
|
||||
|
||||
// Pseudo-ops
|
||||
{name: "PanicNilCheck"}, // trigger a dereference fault; arg0=nil ptr, arg1=mem, returns mem
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue