Brendan Hansknecht
255cc31ad9
change zig bitcode refcounting to require whether or not an element is refcounted
...
This also requires zig bitcode to have access to the dec functions for elements.
This is needed so that zig will be able to free elements in lists.
2024-07-13 10:39:51 -07:00
Folkert
a2d1a1ddb0
simplify the string splitting code (by using std.mem.split)
2024-03-05 16:51:30 +01:00
Richard Feldman
37b154df4f
Remove Str.fromUtf8Range
...
Seamless slices make this obsolete!
2024-02-17 13:20:33 -05:00
Richard Feldman
b2ce7e5fcf
Rearrange where usize -> u64 conversions happen
2024-02-13 12:50:40 -05:00
Richard Feldman
bca6417a9d
Fix @as and @intCast argument order
2024-01-26 16:00:52 -05:00
Richard Feldman
9e3cff61d7
Remove Nat uses from Str
2024-01-26 16:00:33 -05:00
Richard Feldman
b48fa0698a
Remove scalars and graphemes from Str
2024-01-17 21:30:34 -05:00
Brendan Hansknecht
f262102299
cleanup list and str builtin naming from refcount to allocation
2023-12-10 19:52:28 -08:00
Brendan Hansknecht
ca71409a76
add comment on slice construction
2023-12-06 11:26:52 -08:00
Brendan Hansknecht
087ca115c9
create seamless slices when getting a substring
2023-12-05 22:46:43 -08:00
Brendan Hansknecht
2e2e609547
update zig to 0.11 and update build script
...
Also update memcpy to avoid recursive memcpy due to optimizations.
2023-10-23 13:50:30 -07:00
Folkert
c0d67edfd3
cleanup
2023-10-09 15:40:28 +02:00
Folkert
be2c31fe91
more detail
2023-10-09 15:24:44 +02:00
Folkert
ef64e37b9b
use stdlib functions instead of intrinsics
2023-10-09 15:24:44 +02:00
Folkert
c749efb64c
properly return a value
...
on aarch64, returning a big value does not happen with a pointer passed as the first argument (x0). The pointer is passed in the return register (x8) instead. Just use a zig return to generate the right code in both cases
2023-10-09 15:24:39 +02:00
Richard Feldman
1d499a0278
Drop unused str.zig function
...
Signed-off-by: Richard Feldman <oss@rtfeldman.com>
2023-09-12 21:45:53 -04:00
Hannes
97fa6758d0
Rename trimLeft to trimStart and trimRight to trimEnd
2023-06-19 13:17:59 +08:00
Folkert
cf54304cf4
add lowlevel to inc/dec a data pointer
2023-04-28 15:30:23 +02:00
Folkert
dd3d0a188e
string is empty for dev backend
2023-04-23 18:16:08 +02:00
Brendan Hansknecht
457725e87f
fix end offset of fromUtf8Range
2023-03-28 18:53:47 -07:00
Brendan Hansknecht
ce29c7e92f
fix bugs from recent changes and additions
2023-03-16 12:12:27 -07:00
Brendan Hansknecht
48f17a8e2c
add Str.releaseExcessCapacity
2023-03-15 15:24:59 -07:00
Brendan Hansknecht
b8e42b05a2
misc cleanup
2023-03-15 13:25:45 -07:00
Brendan Hansknecht
19039ea5bd
fix edge cases
2023-03-15 13:25:44 -07:00
Brendan Hansknecht
70eef9141f
port string functions to seamless slices
2023-03-15 13:25:40 -07:00
Brendan Hansknecht
3978059aa2
add seamless slices for str
2023-03-15 13:23:34 -07:00
Brendan Hansknecht
0f708d7577
fix accessing bug
2023-03-15 10:06:31 -07:00
Brendan Hansknecht
88a69a23a8
fix type to work on 32bit platforms
2023-03-15 10:06:31 -07:00
Brendan Hansknecht
7f3c67ade9
use isValidUnicode in fromUtf8 to make it faster. Also fix off by one bug.
2023-03-15 10:06:31 -07:00
Brendan Hansknecht
f6677f3c1f
Add a fast path for validating ASCII charcters
...
From my quick testing using the code for testing this function in zig standard lib:
small ascii: 2.2x
small unicode: 0.9x
medium ascii: 15x
medium unicode: 1.01x
medium mix: 3.25x
large ascii: 32.8x
large unicode: 1.03x
large mixed: 3.35x
small being less than 8 bytes.
large being roughly greater than 512 bytes.
2023-03-15 10:06:31 -07:00
Brendan Hansknecht
dfb748fb03
misc cleanup + change refcount pointer to avoid branching
2023-03-13 14:08:24 -07:00
Brendan Hansknecht
216fd3f9f6
Update typo in comment
...
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
Signed-off-by: Brendan Hansknecht <Brendan.Hansknecht@gmail.com>
2023-03-13 14:08:24 -07:00
Brendan Hansknecht
f96a63c1d4
correct case for zig naming
2023-03-13 14:08:23 -07:00
Brendan Hansknecht
146dff5446
add llvm refcounting and fix memory leak
2023-03-13 14:08:23 -07:00
Brendan Hansknecht
7a927b6192
Port fromUtf8 to fromUtf8Range
...
All roc file calls already use fromUtf8Range.
Removed the duplicate function for simplicity.
Inlining should lead to generating the same code.
2023-03-13 14:08:23 -07:00
Brendan Hansknecht
4ced1bcfdd
add baseline of seamless slices
2023-03-13 14:08:23 -07:00
Brendan Hansknecht
e32c5f6514
standardize on decref instead of deinit for name
2023-03-13 14:08:23 -07:00
Brendan Hansknecht
440c0518f1
Change list.deinit to take alignment directly
...
In doing so remove the many class directly to utils.decref
2023-03-13 14:08:22 -07:00
Brendan Hansknecht
0aa932d014
fix mem leak in Str.trim and make all Str.trim* functions consistent
2023-03-02 22:18:26 -08:00
Richard Feldman
b5caddcb77
Merge pull request #4973 from roc-lang/fix-string-split
...
fix string split on overlapping delimiters
2023-01-27 19:34:07 -05:00
Folkert
d52c037cba
fix string split on overlapping delimiters
2023-01-27 17:35:10 +01:00
Folkert
a77f137a9d
fix bug in Str.trim
2023-01-26 22:52:14 +01:00
Folkert
4e5b106f98
use capacity instead of length in list deinit
2023-01-20 21:44:41 +01:00
Folkert
165d4b3450
fix memory leak in string trimming
2023-01-19 14:35:38 +01:00
Folkert
148d24662e
use capacity instead of length in decref
2023-01-08 22:01:35 +01:00
Folkert de Vries
3682e7db6c
Merge pull request #4796 from roc-lang/str-rc-fixes
...
fix missing decref in split and concat
2022-12-22 12:00:53 +01:00
Folkert
1481aea40c
fix missing decref in split and concat
2022-12-22 01:08:31 +01:00
Folkert
6c7d434f81
fix lifetime issue in RocStr.asU8Ptr
2022-12-21 01:43:38 +01:00
Travis Staloch
c2dbed2ff5
str-graphemes: rework and add some zig tests
...
- rework strGraphemes() to use a mutable slice and keep track of just
`last_codepoint_len`.
- add zig tests for empty string, ascii, utf8, ascii+utf8+emoji
2022-10-22 19:29:49 -07:00
Prajwal S N
df7e4eea7e
builtin(str): implement Str.graphemes
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-22 19:29:49 -07:00