aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/string.go
AgeCommit message (Collapse)Author
2024-10-24runtime: add gc layout info for some basic typesDamian Gryski
2024-09-17Cgo add cbytes implementation (rebased version of #3318) (#4470)leongross
cgo: added CBytes implementation
2023-03-27reflect: use direct calls to runtime string functionsAyke van Laethem
The runtime.stringFromBytesTyped and runtime.stringToBytesTyped functions aren't really necessary, because they have the same LLVM IR signature. Therefore, remove them and link directly to the functions that the compiler uses internally.
2023-03-27reflect: add Convert() for string -> []byte and []byte -> stringDamian Gryski
2023-03-03all: use unsafe.Add instead of unsafe.Pointer(uintptr(...) + ...)Ayke van Laethem
We have an optimization for this specific pattern, but it's really just a hack. With the addition of unsafe.Add in Go 1.17 we can directly specify the intent instead and eventually remove this special case. The code is also easier to read.
2022-08-04all: format code according to Go 1.19 rulesAyke van Laethem
Go 1.19 started reformatting code in a way that makes it more obvious how it will be rendered on pkg.go.dev. It gets it almost right, but not entirely. Therefore, I had to modify some of the comments so that they are formatted correctly.
2021-11-24cgo: add support for C.CString and related functionsAyke van Laethem
2021-11-02compiler, runtime: add layout parameter to runtime.allocAyke van Laethem
This layout parameter is currently always nil and ignored, but will eventually contain a pointer to a memory layout. This commit also adds module verification to the transform tests, as I found out that it didn't (and therefore didn't initially catch all bugs).
2021-10-16src/runtime: add another set of invalid unicode runes to encodeUTF8()Damian Gryski
2020-09-21runtime: fix UTF-8 decodingAyke van Laethem
The algorithm now checks for invalid UTF-8 sequences, which is required by the Go spec. This gets the tests of the unicode/utf8 package to pass. Also add bytes.Equal for Go 1.11, which again is necessary for the unicode/utf8 package.
2020-05-16internal/bytealg: reimplement bytealg in pure GoJaden Weiss
Previously, we implemented individual bytealg functions via linknaming, and had to update them every once in a while when we hit linker errors. Instead, this change reimplements the bytealg package in pure Go. If something is missing, it will cause a compiler error rather than a linker error. This is easier to test and maintain.
2019-11-10runtime: only implement CountString for required platformsAyke van Laethem
2019-10-09runtime/all: add implementation of bytealg.CountString to complete #424Ron Evans
Signed-off-by: Ron Evans <[email protected]>
2019-08-11compiler,runtime: implement []rune to string conversionAyke van Laethem
This is used by a few packages in the standard library, at least compress/gzip and regexp/syntax.
2019-06-19compiler,runtime: implement string to []rune conversionscriptonist
Commit message by aykevl
2019-05-24compiler,runtime: fix multiple definitions of a single functionAyke van Laethem
strings.IndexByte was implemented in the runtime up to Go 1.11. It is implemented using a direct call to internal/bytealg.IndexByte since Go 1.12. Make sure we remain compatible with both.
2019-01-27runtime: make stringNext use byteindex only, fix index offsetMichael Teichgraeber
Use stringIterator.byteindex as the loop index, and remove stringIterator.rangeindex, as "the index of the loop is the starting position of the current rune, measured in bytes". This patch also fixes the current loop index returned by stringNext, using `it.byteindex' before - not after - `length' is added.
2019-01-25runtime/strings: add implementation of strings.IndexByte() (#155)Ron Evans
Signed-off-by: Ron Evans <[email protected]>
2018-11-14compiler: update integer type sizesAyke van Laethem
* Use 64-bit integers on 64-bit platforms, just like gc and gccgo: https://golang.org/doc/go1.1#int * Do not use a separate length type. Instead, use uintptr everywhere a length is expected.
2018-11-08compiler: implement binop string: <, <=, >, >=Marc-Antoine Ruel
Include unit tests.
2018-09-22compiler: implement range over a stringAyke van Laethem
2018-09-06all: swap string from {len, ptr} to {ptr, len} for slice compatibilityAyke van Laethem
Having slices and strings be similar makes other code simpler.
2018-09-03compiler: implement []byte(str)Ayke van Laethem
2018-09-02Optimize/eliminate bounds checkingAyke van Laethem
TODO: do better at it by tracking min/max values of integers. The following straightforward code doesn't have its bounds checks removed: for _, n := range slice { println(n) }
2018-08-30Implement casting from (Unicode) integer to stringAyke van Laethem
2018-08-29Implement convert string <- []byteAyke van Laethem
2018-08-29Implement string concatenationAyke van Laethem
2018-08-29Move string type to runtime in separate fileAyke van Laethem