@effekt-lang/effekt 0.77.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/effekt +0 -0
- package/libraries/common/array.effekt +5 -4
- package/libraries/common/bytearray.effekt +45 -26
- package/libraries/common/char.effekt +12 -5
- package/libraries/common/dictionary.effekt +243 -53
- package/libraries/common/effekt.effekt +11 -14
- package/libraries/common/io/filesystem.effekt +7 -7
- package/libraries/common/io/network.effekt +6 -6
- package/libraries/common/io/signal.effekt +10 -10
- package/libraries/common/io/time.effekt +1 -1
- package/libraries/common/io.effekt +4 -4
- package/libraries/common/list.effekt +22 -0
- package/libraries/common/map.effekt +194 -100
- package/libraries/common/process.effekt +3 -2
- package/libraries/common/random.effekt +14 -1
- package/libraries/common/set.effekt +9 -19
- package/libraries/common/string.effekt +28 -0
- package/libraries/common/stringbuffer.effekt +5 -5
- package/libraries/llvm/bytearray.c +15 -6
- package/libraries/llvm/forward-declare-c.ll +1 -0
- package/libraries/llvm/rts.ll +14 -14
- package/licenses/eclipse public license, version 2.0 - epl-2.0.html +3 -3
- package/licenses/mit license - mit-license.html +61 -53
- package/licenses/the bsd license - bsd-license.html +61 -53
- package/licenses/the mit license - mit.html +62 -54
- package/package.json +1 -1
|
@@ -28,11 +28,11 @@ def flushableStringBuffer[A] { program: () => A / { write, flush } }: A = {
|
|
|
28
28
|
program()
|
|
29
29
|
} with write { string =>
|
|
30
30
|
val bytes = fromString(string)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
val n = bytes.size
|
|
32
|
+
ensureCapacity(n)
|
|
33
|
+
// safe: `ensureCapacity` just established the target range
|
|
34
|
+
bytearray::unsafeCopy(bytes, 0, buffer, position, n)
|
|
35
|
+
position = position + n
|
|
36
36
|
resume(())
|
|
37
37
|
} with flush {
|
|
38
38
|
val string = buffer.resize(position).toString()
|
|
@@ -56,6 +56,17 @@ uint8_t* c_bytearray_data(const struct Pos arr) {
|
|
|
56
56
|
return data;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
struct Pos c_bytearray_copy(const struct Pos source, const Int sourceOffset,
|
|
60
|
+
const struct Pos target, const Int targetOffset,
|
|
61
|
+
const Int length) {
|
|
62
|
+
// memmove, not memcpy: the ranges may overlap, and may even be the same bytearray
|
|
63
|
+
memmove(c_bytearray_data(target) + targetOffset,
|
|
64
|
+
c_bytearray_data(source) + sourceOffset, length);
|
|
65
|
+
erasePositive(source);
|
|
66
|
+
erasePositive(target);
|
|
67
|
+
return Unit;
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
struct Pos c_bytearray_construct(const uint64_t n, const uint8_t *data) {
|
|
60
71
|
struct Pos arr = c_bytearray_new(n);
|
|
61
72
|
memcpy(c_bytearray_data(arr), data, n);
|
|
@@ -66,7 +77,7 @@ struct Pos c_bytearray_construct(const uint64_t n, const uint8_t *data) {
|
|
|
66
77
|
|
|
67
78
|
struct Pos c_bytearray_from_nullterminated_string(const char *data) {
|
|
68
79
|
uint64_t n = 0;
|
|
69
|
-
while (data[
|
|
80
|
+
while (data[n]) n++;
|
|
70
81
|
|
|
71
82
|
return c_bytearray_construct(n, (uint8_t*)data);
|
|
72
83
|
}
|
|
@@ -134,11 +145,9 @@ struct Pos c_bytearray_concatenate(const struct Pos left, const struct Pos right
|
|
|
134
145
|
uint64_t left_size = left.tag;
|
|
135
146
|
uint64_t right_size = right.tag;
|
|
136
147
|
const struct Pos concatenated = c_bytearray_new(left_size + right_size);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
? c_bytearray_data(left)[j]
|
|
141
|
-
: c_bytearray_data(right)[j - left_size];
|
|
148
|
+
// two memcpys rather than a byte loop with a branch per byte
|
|
149
|
+
memcpy(c_bytearray_data(concatenated), c_bytearray_data(left), left_size);
|
|
150
|
+
memcpy(c_bytearray_data(concatenated) + left_size, c_bytearray_data(right), right_size);
|
|
142
151
|
|
|
143
152
|
erasePositive(left);
|
|
144
153
|
erasePositive(right);
|
|
@@ -25,6 +25,7 @@ declare %Int @c_bytearray_size(%Pos)
|
|
|
25
25
|
declare %Byte @c_bytearray_get(%Pos, %Int)
|
|
26
26
|
declare %Pos @c_bytearray_set(%Pos, %Int, %Byte)
|
|
27
27
|
|
|
28
|
+
declare %Pos @c_bytearray_copy(%Pos, %Int, %Pos, %Int, %Int)
|
|
28
29
|
declare ptr @c_bytearray_data(%Pos)
|
|
29
30
|
declare %Pos @c_bytearray_construct(i64, ptr)
|
|
30
31
|
|
package/libraries/llvm/rts.ll
CHANGED
|
@@ -101,7 +101,7 @@ declare ptr @malloc(i64)
|
|
|
101
101
|
declare void @free(ptr)
|
|
102
102
|
declare ptr @realloc(ptr, i64)
|
|
103
103
|
declare noalias ptr @calloc(i64, i64)
|
|
104
|
-
declare
|
|
104
|
+
declare ptr @memcpy(ptr, ptr, i64)
|
|
105
105
|
declare i64 @llvm.ctlz.i64 (i64 , i1)
|
|
106
106
|
declare i64 @llvm.fshr.i64(i64, i64, i64)
|
|
107
107
|
declare double @llvm.sqrt.f64(double)
|
|
@@ -117,8 +117,7 @@ declare double @log1p(double)
|
|
|
117
117
|
; Intrinsic versions of the following two only added in LLVM 19
|
|
118
118
|
declare double @atan(double)
|
|
119
119
|
declare double @tan(double)
|
|
120
|
-
declare void @
|
|
121
|
-
declare void @exit(i64)
|
|
120
|
+
declare void @exit(i32)
|
|
122
121
|
declare void @llvm.assume(i1)
|
|
123
122
|
|
|
124
123
|
|
|
@@ -162,7 +161,7 @@ define private void @shareObject(%Object %object) alwaysinline {
|
|
|
162
161
|
|
|
163
162
|
next:
|
|
164
163
|
%objectReferenceCount = getelementptr %Header, ptr %object, i64 0, i32 0
|
|
165
|
-
%referenceCount = load %ReferenceCount, ptr %objectReferenceCount, !alias.scope !14, !noalias !24
|
|
164
|
+
%referenceCount = load %ReferenceCount, ptr %objectReferenceCount, !alias.scope !14, !noalias !24, !range !41
|
|
166
165
|
%referenceCount.1 = add %ReferenceCount %referenceCount, 1
|
|
167
166
|
store %ReferenceCount %referenceCount.1, ptr %objectReferenceCount, !alias.scope !14, !noalias !24
|
|
168
167
|
br label %done
|
|
@@ -189,7 +188,7 @@ define private void @eraseObject(%Object %object) alwaysinline {
|
|
|
189
188
|
|
|
190
189
|
next:
|
|
191
190
|
%objectReferenceCount = getelementptr %Header, ptr %object, i64 0, i32 0
|
|
192
|
-
%referenceCount = load %ReferenceCount, ptr %objectReferenceCount, !alias.scope !14, !noalias !24
|
|
191
|
+
%referenceCount = load %ReferenceCount, ptr %objectReferenceCount, !alias.scope !14, !noalias !24, !range !41
|
|
193
192
|
switch %ReferenceCount %referenceCount, label %decr [%ReferenceCount 0, label %free]
|
|
194
193
|
|
|
195
194
|
decr:
|
|
@@ -334,10 +333,8 @@ realloc:
|
|
|
334
333
|
|
|
335
334
|
define private %StackPointer @stackAllocate(%Stack %stack, i64 %n) alwaysinline {
|
|
336
335
|
%stackPointer_pointer = getelementptr %StackValue, %Stack %stack, i64 0, i32 1
|
|
337
|
-
%limit_pointer = getelementptr %StackValue, %Stack %stack, i64 0, i32 2
|
|
338
336
|
|
|
339
337
|
%currentStackPointer = load %StackPointer, ptr %stackPointer_pointer, !alias.scope !11, !noalias !21
|
|
340
|
-
%limit = load %Limit, ptr %limit_pointer, !alias.scope !11, !noalias !21
|
|
341
338
|
%nextStackPointer = getelementptr i8, %StackPointer %currentStackPointer, i64 %n
|
|
342
339
|
|
|
343
340
|
store %StackPointer %nextStackPointer, ptr %stackPointer_pointer, !alias.scope !11, !noalias !21
|
|
@@ -486,7 +483,7 @@ define private {%Resumption, %Stack} @shift(%Stack %stack, %Prompt %prompt) {
|
|
|
486
483
|
|
|
487
484
|
define private void @erasePrompt(%Prompt %prompt) alwaysinline {
|
|
488
485
|
%referenceCount_pointer = getelementptr %PromptValue, %Prompt %prompt, i64 0, i32 0
|
|
489
|
-
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !13, !noalias !23
|
|
486
|
+
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !13, !noalias !23, !range !41
|
|
490
487
|
switch %ReferenceCount %referenceCount, label %decrement [%ReferenceCount 0, label %free]
|
|
491
488
|
|
|
492
489
|
decrement:
|
|
@@ -501,7 +498,7 @@ free:
|
|
|
501
498
|
|
|
502
499
|
define private void @sharePrompt(%Prompt %prompt) alwaysinline {
|
|
503
500
|
%referenceCount_pointer = getelementptr %PromptValue, %Prompt %prompt, i64 0, i32 0
|
|
504
|
-
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !13, !noalias !23
|
|
501
|
+
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !13, !noalias !23, !range !41
|
|
505
502
|
%newReferenceCount = add %ReferenceCount %referenceCount, 1
|
|
506
503
|
store %ReferenceCount %newReferenceCount, ptr %referenceCount_pointer, !alias.scope !13, !noalias !23
|
|
507
504
|
ret void
|
|
@@ -544,7 +541,7 @@ define private %Stack @copyStack(%Stack %stack) alwaysinline {
|
|
|
544
541
|
%newStackPointer = getelementptr i8, %Stack %newStack, i64 %used
|
|
545
542
|
%newLimit = getelementptr i8, %Stack %newStack, i64 %size
|
|
546
543
|
|
|
547
|
-
call
|
|
544
|
+
%copied = call ptr @memcpy(ptr %newStack, ptr %stack, i64 %used)
|
|
548
545
|
|
|
549
546
|
%newStackPointer_pointer = getelementptr %StackValue, %Stack %newStack, i64 0, i32 1
|
|
550
547
|
%newLimit_pointer = getelementptr %StackValue, %Stack %newStack, i64 0, i32 2
|
|
@@ -569,7 +566,7 @@ define private %Resumption @uniqueStack(%Resumption %resumption) alwaysinline {
|
|
|
569
566
|
|
|
570
567
|
entry:
|
|
571
568
|
%referenceCount_pointer = getelementptr %StackValue, %Resumption %resumption, i64 0, i32 0
|
|
572
|
-
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21
|
|
569
|
+
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21, !range !41
|
|
573
570
|
switch %ReferenceCount %referenceCount, label %copy [%ReferenceCount 0, label %done]
|
|
574
571
|
|
|
575
572
|
done:
|
|
@@ -613,7 +610,7 @@ stop:
|
|
|
613
610
|
|
|
614
611
|
define void @shareResumption(%Resumption %resumption) alwaysinline {
|
|
615
612
|
%referenceCount_pointer = getelementptr %StackValue, %Resumption %resumption, i64 0, i32 0
|
|
616
|
-
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21
|
|
613
|
+
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21, !range !41
|
|
617
614
|
%referenceCount.1 = add %ReferenceCount %referenceCount, 1
|
|
618
615
|
store %ReferenceCount %referenceCount.1, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21
|
|
619
616
|
ret void
|
|
@@ -621,7 +618,7 @@ define void @shareResumption(%Resumption %resumption) alwaysinline {
|
|
|
621
618
|
|
|
622
619
|
define void @eraseResumption(%Resumption %resumption) alwaysinline {
|
|
623
620
|
%referenceCount_pointer = getelementptr %StackValue, %Resumption %resumption, i64 0, i32 0
|
|
624
|
-
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21
|
|
621
|
+
%referenceCount = load %ReferenceCount, ptr %referenceCount_pointer, !alias.scope !11, !noalias !21, !range !41
|
|
625
622
|
switch %ReferenceCount %referenceCount, label %decr [%ReferenceCount 0, label %free]
|
|
626
623
|
|
|
627
624
|
decr:
|
|
@@ -914,4 +911,7 @@ define ccc %CObject @coercePosObj(%Pos %input) {
|
|
|
914
911
|
!22 = !{!1, !3, !4, !5} ; not stackPointer
|
|
915
912
|
!23 = !{!1, !2, !4, !5} ; not prompt
|
|
916
913
|
!24 = !{!1, !2, !3, !5} ; not object
|
|
917
|
-
!25 = !{!1, !2, !3, !4 } ; not vtable
|
|
914
|
+
!25 = !{!1, !2, !3, !4 } ; not vtable
|
|
915
|
+
|
|
916
|
+
; Ranges
|
|
917
|
+
!41 = !{i64 0, i64 9223372036854775807} ; positive i64
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Eclipse Public License 2.0 (EPL) | The Eclipse Foundation</title>
|
|
2
|
-
<meta property="og:title" content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=twitter:title content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta property="og:description" content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=twitter:description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=author content="Wayne Beaton"><link href=/favicon.ico rel=icon type=image/x-icon><meta property="og:image" content="https://www.eclipse.org/images/og-image-template_hu_cdf3b1afdf89db6f.png"><meta name=twitter:image content="https://www.eclipse.org/images/og-image-template_hu_cdf3b1afdf89db6f.png"><meta name=twitter:card content="summary"><meta name=twitter:site content="@eclipsefdn"><meta name=twitter:creator content="@eclipsefdn"><meta property="og:url" content="https://www.eclipse.org/legal/epl-2.0/"><meta property="og:type" content="website"><meta property="og:site_name" content="Eclipse Foundation"><meta name=keywords content="epl,epl-2.0,legal,foundation,eclipse,eclipse public license,license,licenses"><meta name=generator content="Hugo 0.144.2"><link rel=canonical href=https://www.eclipse.org/legal/epl-2.0/><link rel=alternate href=https://www.eclipse.org//legal/epl-2.0/index.xml type=application/rss+xml title><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-5WLCZXC")</script><script>var tableClasses="table"</script><link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel=stylesheet type=text/css> <script type="module" crossorigin src="/public/assets/legal/epl-2.0/index-
|
|
3
|
-
<link rel="modulepreload" crossorigin href="/public/assets/main-
|
|
2
|
+
<meta property="og:title" content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=twitter:title content="Eclipse Public License 2.0 (EPL) | The Eclipse Foundation"><meta name=description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta property="og:description" content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=twitter:description content="The Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …"><meta name=author content="Wayne Beaton"><link href=/favicon.ico rel=icon type=image/x-icon><meta property="og:image" content="https://www.eclipse.org/images/og-image-template_hu_cdf3b1afdf89db6f.png"><meta name=twitter:image content="https://www.eclipse.org/images/og-image-template_hu_cdf3b1afdf89db6f.png"><meta name=twitter:card content="summary"><meta name=twitter:site content="@eclipsefdn"><meta name=twitter:creator content="@eclipsefdn"><meta property="og:url" content="https://www.eclipse.org/legal/epl-2.0/"><meta property="og:type" content="website"><meta property="og:site_name" content="Eclipse Foundation"><meta name=keywords content="epl,epl-2.0,legal,foundation,eclipse,eclipse public license,license,licenses"><meta name=generator content="Hugo 0.144.2"><link rel=canonical href=https://www.eclipse.org/legal/epl-2.0/><link rel=alternate href=https://www.eclipse.org//legal/epl-2.0/index.xml type=application/rss+xml title><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-5WLCZXC")</script><script>var tableClasses="table"</script><link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel=stylesheet type=text/css> <script type="module" crossorigin src="/public/assets/legal/epl-2.0/index-KKbnVOd8.js"></script>
|
|
3
|
+
<link rel="modulepreload" crossorigin href="/public/assets/main-BKIcjYwC.js">
|
|
4
4
|
<link rel="modulepreload" crossorigin href="/public/assets/get-body-content-D33PtpOf.js">
|
|
5
5
|
<link rel="modulepreload" crossorigin href="/public/assets/generate-body-content-BZFBJ1cI.js">
|
|
6
|
-
<link rel="stylesheet" crossorigin href="/public/assets/main-
|
|
6
|
+
<link rel="stylesheet" crossorigin href="/public/assets/main-BzlpBkIh.css">
|
|
7
7
|
</head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5WLCZXC" height=0 width=0 style=display:none;visibility:hidden></iframe></noscript><a href=#main class=skip-link>Skip to content</a><div class=eclipsefdn-featured-story-banner data-publish-target=eclipse_org></div><header class="header-wrapper header-wrapper" id=header><div class="navigation-bar dark"><div class=container><div class=navigation-bar-inner><div class=navigation-bar-left><a class="focus-highlight focus-inverse" href=/><img class=navigation-bar-brand src=https://www.eclipse.org/eclipse.org-common/themes/solstice/public/images/logo/eclipse-foundation-white-orange.svg alt="Eclipse Foundation"></a></div><nav class="navigation-bar-nav hidden-xs hidden-sm"><ul><li><button type=button class="btn btn-link" data-target=join-us-menu>Join us</button></li><li><button type=button class="btn btn-link" data-target=what-we-do-menu>What we do</button></li><li><button type=button class="btn btn-link" data-target=resources-menu>Resources</button></li><li><button type=button class="btn btn-link" data-target=about-us-menu>About us</button></li></ul></nav><div class=navigation-bar-right><div class="navigation-bar-controls hidden-xs hidden-sm"><ul><li class=dropdown><a class="dropdown-toggle link-unstyled focus-highlight" tabindex=0 id=search-dropdown-toggle data-toggle=dropdown href=# aria-label=Search><i class="fa-solid fa-magnifying-glass" aria-hidden=true></i></a><form class="search-bar dropdown-menu dropdown-menu-right" aria-labelledby=search-dropdown-toggle action=https://www.eclipse.org/home/search/ method=get><input class=search-bar-input name=q placeholder=Search>
|
|
8
8
|
<button class="btn btn-link" type=submit>
|
|
9
9
|
<i class="fa-solid fa-arrow-right"></i></button></form></li><li class=dropdown><a class="dropdown-toggle focus-highlight" id=user-menu href=# data-toggle=dropdown aria-haspopup=true aria-expanded=false tabindex=0><i class="fa-regular fa-user" aria-hidden=true></i></a><ul class="dropdown-menu dropdown-menu-right" aria-labelledby=user-menu><li><a href=https://accounts.eclipse.org/user><i class="fa-solid fa-user margin-right-10" aria-hidden=true></i>
|