From 8938a86917d0aeabd55d417bb68f967e2b578a4e Mon Sep 17 00:00:00 2001 From: Aleksey Rakov Date: Mon, 7 Oct 2024 13:09:39 +0200 Subject: [PATCH] Iteration33 (#693) * [ADDED] supporting async methods * [FIXED][ldoc] system-threading-.html must not be generated * [API][ADDED] File : saveContent, readContent, readWideContent * [API][ADDED] system'io'threading : asyncStreamOp extension * [Samples][ADDED] asyncsamples * [FIXED] it is not possible to declare internal default constructor * [IDE][FIXED] project options - debug command arguments * [Sample][ADDED] task sample 2 * [API][ADDED] extensions'threading : outputConcurrentOp extension * [API][REDUX] all symbols must start with a capital letter * [API][ADDED] system'threading : Task * [ADDED]Task example * JIT : index table generating (fixed order, after the main method table; terminated by 0) * [ADDED]functional test : indexed multi-method * [ADDED] supporting indexed methods * [ADDED] indexed internal methods can be declared in a closed class * [ADDED] system'threading : Task * [FIXED] system'objectOp.__getClassName[1] * [FIXED][ldoc] system-threading : generate only templates declared in the module * [FIXED] #675 - Using ++ operator with a weak type * [FIXED] incorrect typecast handler signature for the classes inheriting template-based ones * [FIXED] correct debug info of the constructor self variable * [FIXED]#413 - boxing variadic argument --- .github/workflows/msbuild.yml | 2 +- VERSION | 2 +- asm/aarch64/core60.asm | 310 + asm/amd64/core60.asm | 175 + asm/amd64/corex60.asm | 243 +- asm/ppc64le/core60.asm | 275 + asm/x32/core60.asm | 171 + bin/templates/lib60.cfg | 2 + build/aarch64/build_package_arm64.script | 2 +- build/aarch64/control | 2 +- build/amd64/build_package_amd64.script | 2 +- build/amd64/control | 2 +- build/elena_inno.iss | 6 +- build/i386/build_package_i386.script | 2 +- build/i386/control | 2 +- build/ppc64le/build_package_ppc64le.script | 2 +- build/ppc64le/control | 2 +- dat/api2html/api2html.bat | 2 + dat/sg/syntax60.txt | 28 +- doc/api/algorithms-summary.html | 2 +- doc/api/algorithms.html | 2 +- doc/api/cellular-summary.html | 2 +- doc/api/cellular.html | 2 +- doc/api/extensions-dynamic-summary.html | 2 +- doc/api/extensions-dynamic.html | 2 +- doc/api/extensions-io-summary.html | 32 +- doc/api/extensions-io.html | 434 +- doc/api/extensions-math-summary.html | 6 +- doc/api/extensions-math.html | 6 +- doc/api/extensions-routines-summary.html | 2 +- doc/api/extensions-routines.html | 2 +- doc/api/extensions-scripting-summary.html | 2 +- doc/api/extensions-scripting.html | 2 +- doc/api/extensions-summary.html | 32 +- doc/api/extensions-text-summary.html | 6 +- doc/api/extensions-text.html | 12 +- doc/api/extensions.html | 147 +- doc/api/forms-summary.html | 2 +- doc/api/forms.html | 2 +- doc/api/index.html | 21 - doc/api/ltests-summary.html | 2 +- doc/api/ltests.html | 2 +- doc/api/net-summary.html | 2 +- doc/api/net.html | 2 +- doc/api/sqlite-summary.html | 6 +- doc/api/sqlite.html | 6 +- doc/api/system-calendar-summary.html | 24 +- doc/api/system-calendar.html | 80 +- doc/api/system-collections-summary.html | 93 +- ...system-collections-threadsafe-summary.html | 92 +- doc/api/system-collections-threadsafe.html | 1569 +-- doc/api/system-collections.html | 1557 +-- doc/api/system-culture-summary.html | 9 +- doc/api/system-culture.html | 9 +- doc/api/system-drawing-summary.html | 2 +- doc/api/system-drawing.html | 2 +- .../system-dynamic-expressions-summary.html | 2 +- doc/api/system-dynamic-expressions.html | 11 +- doc/api/system-dynamic-summary.html | 2 +- doc/api/system-dynamic.html | 2 +- doc/api/system-io-summary.html | 60 +- doc/api/system-io.html | 1724 ++- doc/api/system-math-summary.html | 35 +- doc/api/system-math.html | 80 +- doc/api/system-net-summary.html | 2 +- doc/api/system-net.html | 2 +- doc/api/system-routines-summary.html | 2 +- doc/api/system-routines.html | 2 +- doc/api/system-runtime-summary.html | 2 +- doc/api/system-runtime.html | 2 +- doc/api/system-summary.html | 287 +- doc/api/system-text-summary.html | 32 +- doc/api/system-text.html | 405 +- doc/api/system-threading-summary.html | 117 +- doc/api/system-threading.html | 2092 +--- doc/api/system-winforms-summary.html | 2 +- doc/api/system-winforms.html | 6 +- doc/api/system.html | 9241 ++++++++++------- doc/tech/bytecode60.txt | 10 +- doc/todo.txt | 39 +- elenasrc3/elc/clicommon.h | 24 +- elenasrc3/elc/cliconst.h | 2 +- elenasrc3/elc/compiler.cpp | 3381 +++--- elenasrc3/elc/compiler.h | 66 +- elenasrc3/elc/compilerlogic.cpp | 67 +- elenasrc3/elc/compilerlogic.h | 46 +- .../elena-tests/tests_bt_optimization.cpp | 32 +- elenasrc3/elena-tests/tests_constructor.cpp | 4 +- elenasrc3/elenart/elenartmachine.cpp | 4 +- elenasrc3/elenavm/elenavmmachine.cpp | 2 +- elenasrc3/engine/bcwriter.cpp | 42 +- elenasrc3/engine/bcwriter.h | 6 +- elenasrc3/engine/buildtree.h | 1 + elenasrc3/engine/bytecode.cpp | 2 +- elenasrc3/engine/bytecode.h | 1 + elenasrc3/engine/elena.h | 19 +- elenasrc3/engine/elenaconst.h | 116 +- elenasrc3/engine/jitcompiler.cpp | 206 +- elenasrc3/engine/jitcompiler.h | 23 +- elenasrc3/engine/jitlinker.cpp | 182 +- elenasrc3/engine/jitlinker.h | 33 +- elenasrc3/engine/langcommon.h | 116 +- elenasrc3/ide/idecontroller.cpp | 2 +- elenasrc3/ide/ideproject.cpp | 4 +- elenasrc3/ide/ideproject.h | 2 +- elenasrc3/ide/ideversion.h | 2 +- elenasrc3/tools/asmc/x86assembler.cpp | 9 + elenasrc3/tools/ldoc/ldoc.cpp | 22 +- elenasrc3/tools/ldoc/ldocconst.h | 4 +- examples60/console/binary/binary.l | 6 +- examples60/console/bsort/bsort.l | 8 +- examples60/console/build.bat | 4 +- examples60/console/collatz/collatz.l | 32 +- examples60/console/datetime/control.l | 12 +- examples60/console/datetime/datetime.prj | 4 +- examples60/console/goods/goods.l | 8 +- examples60/console/helloworld/helloworld.l | 4 +- examples60/console/matrix/matrix.l | 38 +- examples60/console/matrix/matrix.prj | 4 +- examples60/console/pi/pi.l | 10 +- examples60/console/pi2/pi2.l | 22 +- examples60/console/random/random.l | 32 +- examples60/console/replace/replace.l | 8 +- examples60/console/sum/sum.l | 8 +- examples60/console/trans/control.l | 4 +- examples60/console/trans/translit.l | 4 +- examples60/console/words/words.l | 10 +- examples60/files/textdb/textdb.l | 4 +- examples60/files/textfile/textfile.l | 4 +- examples60/net/chat/client_cui/main.l | 2 +- examples60/rosetta/anagram/anagram.l | 4 +- examples60/rosetta/brackets/brackets.l | 2 +- examples60/rosetta/treeview/treeview.l | 2 +- examples60/scripts/calc/control.l | 2 +- examples60/threads/async/asyncsamples.prj | 15 + examples60/threads/async/main.l | 10 + examples60/threads/async/sample1.l | 30 + examples60/threads/async/sample2.l | 25 + examples60/threads/tasks/main.l | 4 +- examples60/threads/tasks/sample1.l | 2 +- examples60/threads/tasks/sample2.l | 28 + examples60/threads/tasks/sample3.l | 22 + examples60/threads/tasks/tasksamples.prj | 2 + examples60/threads/threadpool/sample1.l | 6 +- examples60/threads/threadpool/sample2.l | 10 +- src60/extensions/app.l | 8 +- src60/extensions/basic.l | 2 +- src60/extensions/convertors.l | 4 +- src60/extensions/extensions.prj | 4 + src60/extensions/io/bytearray.l | 12 +- src60/extensions/lnx_args.l | 7 +- src60/extensions/math/matrix.l | 2 +- src60/extensions/random.l | 4 +- src60/extensions/routines/stex/convertors.l | 15 + src60/extensions/text/strings.l | 14 +- src60/extensions/threading/console.l | 15 + src60/extensions/win_args.l | 8 +- src60/system/app.l | 4 +- src60/system/attributes/attributes.l | 5 +- src60/system/calendar/dates.l | 9 +- src60/system/closures.l | 5 + src60/system/collections/list.l | 12 + src60/system/console.l | 50 +- src60/system/extensions.l | 8 +- src60/system/io/common.l | 2 +- src60/system/io/files.l | 40 +- src60/system/io/lnx_console.l | 2 +- src60/system/io/memorystream.l | 8 +- src60/system/io/streamreader.l | 75 +- src60/system/io/streamwriter.l | 2 +- src60/system/io/threading/async_common.l | 13 + src60/system/io/win_files.l | 8 +- src60/system/lnx_app.l | 2 +- src60/system/lnx_strings.l | 2 +- src60/system/pointers.l | 4 +- src60/system/strings.l | 3 + src60/system/system.prj | 5 +- src60/system/system.project | 2 +- src60/system/text/encoding.l | 34 +- src60/system/text/textbuffer.l | 8 +- src60/system/text/win_encoding.l | 6 +- src60/system/threading/tasks.l | 132 +- src60/system/threading/template_tests.l | 1 + src60/system/threading/templates.l | 54 +- src60/system/win_app.l | 2 +- src60/system/win_strings.l | 2 +- src60/system/winforms/win_app.l | 4 +- tests60/sandbox/sandbox.l | 35 +- tests60/system_tests/basic.l | 154 +- 189 files changed, 13435 insertions(+), 11733 deletions(-) create mode 100644 examples60/threads/async/asyncsamples.prj create mode 100644 examples60/threads/async/main.l create mode 100644 examples60/threads/async/sample1.l create mode 100644 examples60/threads/async/sample2.l create mode 100644 examples60/threads/tasks/sample2.l create mode 100644 examples60/threads/tasks/sample3.l create mode 100644 src60/extensions/routines/stex/convertors.l create mode 100644 src60/extensions/threading/console.l create mode 100644 src60/system/io/threading/async_common.l diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index c44f68a4b9..017c054891 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -20,7 +20,7 @@ env: # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix BUILD_CONFIGURATION: Release - BUILD_TAG: 6.3.2 + BUILD_TAG: 6.4.3 permissions: contents: read diff --git a/VERSION b/VERSION index f9da12e118..8e0a2119a7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.3.2 \ No newline at end of file +6.4.3 \ No newline at end of file diff --git a/asm/aarch64/core60.asm b/asm/aarch64/core60.asm index 463f2c4c53..eb59389e2c 100644 --- a/asm/aarch64/core60.asm +++ b/asm/aarch64/core60.asm @@ -3438,6 +3438,21 @@ inline %0ECh end +// ; vjumpmr +inline %6ECh + + sub x14, x10, elVMTOffset + ldr x14, [x14] + add x17, x14, __arg12_1 + sub x14, x14, elVMTSizeOffset + ldr x14, [x14] + lsl x14, x14, #4 + add x17, x17, x14 + ldr x17, [x17] + br x17 + +end + // ; jumpmr inline %0EDh @@ -4661,6 +4676,285 @@ labNextBaseClass: end + +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 6FBh + + str x0, [sp] // ; saving arg0 +//; lea rax, [rsp + __n_2] + add x17, sp, __n12_2 +//; mov [rsp+16], r11 // ; saving arg0 + str x1, [sp, #8] + + sub x17, x17, #8 // ; HOTFIX : caller address is not in the stack + +//; mov rsi, __ptr64_2 + movz x21, __ptr32lo_2 + movk x21, __ptr32hi_2, lsl #16 + +//; xor edx, edx + mov x25, #0 +//; mov rbx, [rsi] // ; message from overload list + ldr x22, [x21, #0] + +labNextOverloadlist: +//; mov r9, mdata : %0 + movz x24, mdata_ptr32lo : #0 //;-- + movk x24, mdata_ptr32hi : #0, lsl #16 + +//; shr ebx, ACTION_ORDER + lsr x22, x22, # ACTION_ORDER +//; lea r13, [rbx*8] + lsl x23, x22, #4 + +//; mov r13, [r9 + r13 * 2 + 8] + add x23, x23, x24 + ldr x23, [x23, #8] + +//; mov ecx, __n_1 + mov x16, __n16_1 + +//; lea rbx, [r13 - 8] + sub x22, x23, #8 + +labNextParam: +//; sub ecx, 1 + sub x16, x16, #1 + +//; jnz short labMatching + cmp x16, #0 + bne labMatching + +//; mov r9, __ptr64_2 - r21 + + lsl x23, x25, #4 + add x25, x21, x23 + ldr x9, [x25] + ldr x23, [x25, #8] + + sub x16, x10, elVMTOffset + ldr x16, [x16, #0] + + sub x20, x16, elVMTSizeOffset + ldr x20, [x20, #0] + lsl x20, x20, #4 + add x16, x16, x20 + +//; jmp [rcx + rax + 8] // rax - 0 + add x20, x16, x23 + + ldr x17, [x20, #8] + br x17 + +labMatching: +//; mov rdi, [rax + rcx * 8] + lsl x19, x16, #3 + add x18, x19, x17 + ldr x18, [x18] + + //; check nil +//; mov rsi, rdata : %VOIDPTR + elObjectOffset + movz x20, rdata_ptr32lo : %VOIDPTR + movk x20, rdata_ptr32hi : %VOIDPTR, lsl #16 + add x20, x20, elObjectOffset + +//; test rdi, rdi + cmp x18, #0 + +//; cmovz rdi, rsi + csel x18, x20, x18, eq + +//; mov rdi, [rdi - elVMTOffset] + sub x18, x18, elVMTOffset + ldr x18, [x18, #0] + +//; mov rsi, [rbx + rcx * 8] + add x20, x22, x19 + ldr x20, [x20] + +labNextBaseClass: +//; cmp rsi, rdi + cmp x20, x18 + +//; jz labNextParam + beq labNextParam +//; mov rdi, [rdi - elPackageOffset] + sub x18, x18, elPackageOffset + ldr x18, [x18] + +//; and rdi, rdi + cmp x18, #0 +//; jnz short labNextBaseClass + bne labNextBaseClass + +//; add rdx, 1 + add x25, x25, #1 +//; mov r13, __ptr32_2 + mov x23, x21 + +//; lea r9, [rdx * 8] + lsl x24, x25, 4 + +//; mov rbx, [r13 + r9 * 2] // ; message from overload list + add x22, x24, x23 + ldr x22, [x22] + +//; and rbx, rbx + cmp x22, 0 +//; jnz labNextOverloadlist + bne labNextOverloadlist + +end + +// ; dispatchmr +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 0BFBh + + str x0, [sp] // ; saving arg0 +//; lea rax, [rsp + __n_2] + add x17, sp, __n12_2 +//; mov [rsp+16], r11 // ; saving arg0 + str x1, [sp, #8] + + sub x17, x17, #8 // ; HOTFIX : caller address is not in the stack + +//; mov rsi, __ptr64_2 + movz x21, __ptr32lo_2 + movk x21, __ptr32hi_2, lsl #16 + +//; xor edx, edx + mov x25, #0 + mov x11, #0 + + // ; count the number of args + mov x22, x17 + mov x23, #0 + sub x23, x23, #1 // ; define the terminator +labCountParam: + add x22, x22, #8 + ldr x24, [x22] + add x16, x16, 1 + cmp x24, x23 + bne labCountParam + mov x17, x11 + +//; mov rbx, [rsi] // ; message from overload list + ldr x22, [x21, #0] + +labNextOverloadlist: +//; mov r9, mdata : %0 + movz x24, mdata_ptr32lo : #0 //;-- + movk x24, mdata_ptr32hi : #0, lsl #16 + +//; shr ebx, ACTION_ORDER + lsr x22, x22, # ACTION_ORDER +//; lea r13, [rbx*8] + lsl x23, x22, #4 + +//; mov r13, [r9 + r13 * 2 + 8] + add x23, x23, x24 + ldr x23, [x23, #8] + +//; mov ecx, __n_1 + mov x16, x17 + +//; lea rbx, [r13 - 8] + sub x22, x23, #8 + +labNextParam: +//; sub ecx, 1 + sub x16, x16, #1 + +//; jnz short labMatching + cmp x16, x17 + bne labMatching + +//; mov r9, __ptr64_2 - r21 + + lsl x23, x25, #4 + add x25, x21, x23 + ldr x9, [x25] + ldr x23, [x25, #8] + + sub x16, x10, elVMTOffset + ldr x16, [x16, #0] + + sub x20, x16, elVMTSizeOffset + ldr x20, [x20, #0] + lsl x20, x20, #4 + add x16, x16, x20 + +//; jmp [rcx + rax + 8] // rax - 0 + add x20, x16, x23 + + ldr x17, [x20, #8] + br x17 + +labMatching: + add x20, x26, #8 + ldr x18, [x20] + cmp x18, #0 + csel x26, x26, x20, eq + +//; mov rdi, [rax + rcx * 8] + lsl x19, x16, #3 + add x18, x19, x17 + ldr x18, [x18] + + //; check nil +//; mov rsi, rdata : %VOIDPTR + elObjectOffset + movz x20, rdata_ptr32lo : %VOIDPTR + movk x20, rdata_ptr32hi : %VOIDPTR, lsl #16 + add x20, x20, elObjectOffset + +//; test rdi, rdi + cmp x18, #0 + +//; cmovz rdi, rsi + csel x18, x20, x18, eq + +//; mov rdi, [rdi - elVMTOffset] + sub x18, x18, elVMTOffset + ldr x18, [x18, #0] + +//; mov rsi, [rbx + rcx * 8] + ldr x20, [x26] + +labNextBaseClass: +//; cmp rsi, rdi + cmp x20, x18 + +//; jz labNextParam + beq labNextParam +//; mov rdi, [rdi - elPackageOffset] + sub x18, x18, elPackageOffset + ldr x18, [x18] + +//; and rdi, rdi + cmp x18, #0 +//; jnz short labNextBaseClass + bne labNextBaseClass + +//; add rdx, 1 + add x25, x25, #1 +//; mov r13, __ptr32_2 + mov x23, x21 + +//; lea r9, [rdx * 8] + lsl x24, x25, 4 + +//; mov rbx, [r13 + r9 * 2] // ; message from overload list + add x22, x24, x23 + ldr x22, [x22] + +//; and rbx, rbx + cmp x22, 0 +//; jnz labNextOverloadlist + bne labNextOverloadlist + +end + // ; vcallmr inline %0FCh @@ -4673,6 +4967,22 @@ inline %0FCh end +// ; vcallmr +inline %06FCh + + mov x18, __arg16_1 + sub x14, x10, elVMTOffset + ldr x14, [x14] + add x17, x14, x18 + sub x14, x14, elVMTSizeOffset + ldr x14, [x14] + lsl x14, x14, #4 + add x17, x17, x14 + ldr x17, [x17, #8] + blr x17 + +end + // ; callmr inline %0FDh diff --git a/asm/amd64/core60.asm b/asm/amd64/core60.asm index 40693376f3..bd6b19dd44 100644 --- a/asm/amd64/core60.asm +++ b/asm/amd64/core60.asm @@ -2737,6 +2737,17 @@ inline % 0ECh end +// ; vjumpmr +inline % 06ECh + + mov rax, [rbx - elVMTOffset] + mov rdi, [rax - elVMTSizeOffset] + shl rdi, 4 + lea rax, [rax + rdi] + jmp [rax + __arg32_1] + +end + // ; jumpmr inline %0EDh @@ -4140,6 +4151,158 @@ labNextBaseClass: end +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 6FBh + + mov r8, rbx + mov [rsp+8], r10 // ; saving arg0 + lea rax, [rsp + __n_2] + mov [rsp+16], r11 // ; saving arg0 + + mov rsi, __ptr64_2 + xor edx, edx + mov rbx, [rsi] // ; message from overload list + +labNextOverloadlist: + mov r9, mdata : %0 + shr ebx, ACTION_ORDER + lea r13, [rbx*8] + mov r13, [r9 + r13 * 2 + 8] + mov ecx, __n_1 + lea rbx, [r13 - 8] + +labNextParam: + sub ecx, 1 + jnz short labMatching + + mov r9, __ptr64_2 + lea r13, [rdx * 8] + mov rbx, r8 + mov rax, [r9 + r13 * 2 + 8] + mov rdx, [r9 + r13 * 2] + mov rcx, [rbx - elVMTOffset] + mov rdi, [rcx - elVMTSizeOffset] + shl rdi, 4 + lea rcx, [rcx + rdi] + jmp [rcx + rax + 8] + +labMatching: + mov rdi, [rax + rcx * 8] + + //; check nil + mov rsi, rdata : %VOIDPTR + elObjectOffset + test rdi, rdi + cmovz rdi, rsi + + mov rdi, [rdi - elVMTOffset] + mov rsi, [rbx + rcx * 8] + +labNextBaseClass: + cmp rsi, rdi + jz labNextParam + mov rdi, [rdi - elPackageOffset] + and rdi, rdi + jnz short labNextBaseClass + + add rdx, 1 + mov r13, __ptr64_2 + lea r9, [rdx * 8] + mov rbx, [r13 + r9 * 2] // ; message from overload list + and rbx, rbx + jnz labNextOverloadlist + + mov rbx, r8 + mov edx, __arg32_1 + +end + +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 0BFBh + + mov r8, rbx + mov [rsp+8], r10 // ; saving arg0 + lea rax, [rsp + __n_2] + mov [rsp+16], r11 // ; saving arg0 + + mov rsi, __ptr64_2 + xor edx, edx + xor ecx, ecx + + mov rbx, rax + mov r9, -1 +labCountParam: + lea rbx, [rbx+8] + cmp r9, [rbx] + lea rcx, [rcx+1] + jnz short labCountParam + mov r15, rcx + + mov rbx, [rsi] // ; message from overload list + +labNextOverloadlist: + mov r9, mdata : %0 + shr ebx, ACTION_ORDER + lea r13, [rbx*8] + mov r13, [r9 + r13 * 2 + 8] + xor ecx, ecx + lea rbx, [r13 - 8] + + mov r14, rbx + +labNextParam: + add ecx, 1 + cmp rcx, r15 + jnz short labMatching + + mov r9, __ptr64_2 + lea r13, [rdx * 8] + mov rbx, r8 + mov rax, [r9 + r13 * 2 + 8] + mov rdx, [r9 + r13 * 2] + mov rcx, [rbx - elVMTOffset] + mov rdi, [rcx - elVMTSizeOffset] + shl rdi, 4 + lea rcx, [rcx + rdi] + jmp [rcx + rax + 8] + +labMatching: + mov rdi, r14 + lea rdi, [rdi + 8] + cmp [rdi], 0 + cmovnz r14, rdi + + mov rdi, [rax + rcx * 8] + + //; check nil + mov rsi, rdata : %VOIDPTR + elObjectOffset + test rdi, rdi + cmovz rdi, rsi + + mov rdi, [rdi - elVMTOffset] + mov rsi, r14 + mov rsi, [rsi] + +labNextBaseClass: + cmp rsi, rdi + jz labNextParam + mov rdi, [rdi - elPackageOffset] + and rdi, rdi + jnz short labNextBaseClass + + add rdx, 1 + mov r13, __ptr64_2 + lea r9, [rdx * 8] + mov rbx, [r13 + r9 * 2] // ; message from overload list + and rbx, rbx + jnz labNextOverloadlist + + mov rbx, r8 + mov edx, __arg32_1 + +end + // ; vcallmr inline % 0FCh @@ -4149,6 +4312,18 @@ inline % 0FCh end +// ; vcallmr +inline % 06FCh + + mov rax, [rbx - elVMTOffset] + mov ecx, __arg32_1 + mov rdi, [rax - elVMTSizeOffset] + shl rdi, 4 + lea rax, [rax + rdi] + call [rax + rcx + 8] + +end + // ; callmr inline %0FDh diff --git a/asm/amd64/corex60.asm b/asm/amd64/corex60.asm index 33d1ba011b..9f5df14e6b 100644 --- a/asm/amd64/corex60.asm +++ b/asm/amd64/corex60.asm @@ -24,6 +24,7 @@ define ARG_MASK 01Fh define ARG_ACTION_MASK 1DFh // ; --- Object header fields --- +define elSyncOffset 0008h define elSizeOffset 0004h define elVMTOffset 0010h define elObjectOffset 0010h @@ -536,7 +537,7 @@ labSkipWait: end // --- THREAD_WAIT --- -// GCXT: it is presumed that gc lock is on, edx - contains the collecting thread event handle +// GCXT: it is presumed that gc lock is on, rdx - contains the collecting thread event handle procedure % THREAD_WAIT @@ -586,3 +587,243 @@ labWait: ret end + +// ; --- System Core Preloaded Routines -- + +// ; ==== Command Set == + +// ; snop +inline % 2 + + // ; safe point + mov rdx, [data : %CORE_GC_TABLE + gc_signal] + test rdx, rdx // ; if it is a collecting thread, waits + jz short labConinue // ; otherwise goes on + + nop + nop + call %THREAD_WAIT // ; waits until the GC is stopped + +labConinue: + +end + +// ; throw +inline %0Ah + + mov rcx, gs:[58h] + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, [rcx+rax*8] + mov rdi, [rcx + et_current] + jmp [rdi + es_catch_addr] + +end + +// ; unhook +inline %0Bh + + // ; GCXT: get current thread frame + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, gs:[58h] + mov rcx, [rcx+rax*8] + mov rdi, [rcx + et_current] + + mov rax, [rdi + es_prev_struct] + mov rbp, [rdi + es_catch_frame] + mov rsp, [rdi + es_catch_level] + + mov [rcx + et_current], rax + +end + +// ; exclude +inline % 10h + + mov rcx, gs:[58h] + mov rax, [data : %CORE_TLS_INDEX] + mov rdi, [rcx+rax*8] + mov dword ptr [rdi + tt_flags], 1 + mov rax, [rdi + tt_stack_frame] + push rax + push rbp + mov [rdi + tt_stack_frame], rsp + +end + +// ; include +inline % 11h + + add rsp, 8 + mov rcx, gs:[58h] + mov rax, [data : %CORE_TLS_INDEX] + mov rdi, [rcx+rax*8] + mov dword ptr [rdi + tt_flags], 0 + pop rax + mov [rdi + tt_stack_frame], rax + +end + +// ; tststck +inline %17h + + // ; COREX + mov rcx, gs:[58h] + mov rax, [data : %CORE_TLS_INDEX] + mov rdi, [rcx+rax*8] + mov rax, [rdi + tt_stack_root] + + xor ecx, ecx + cmp rbx, rsp + setl cl + cmp rbx, rax + setg ch + cmp ecx, 0 + +end + +// ; trylock +inline %02Bh + + // ; GCXT: try to lock + xor eax, eax + mov ecx, 1 + lock cmpxchg byte ptr[rbx - elSyncOffset], cl + test eax, eax + +end + +// ; freelock +inline %02Ch + + mov ecx, -1 + + // ; free lock + lock xadd byte ptr [rbx - elSyncOffset], cl + +end + +// ; peektls +inline %0BBh + + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, gs:[58h] + mov rax, [rcx + rax * 8] + lea rdi, [rax + __arg32_1] + mov rbx, [rdi] + +end + +// ; storetls +inline %0BCh + + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, gs:[58h] + mov rax, [rcx + rax * 8] + lea rdi, [rax + __arg32_1] + mov [rdi], rbx + +end + +// ; system minor collect +inline %1CFh + + mov rdi, data : %CORE_GC_TABLE + gc_lock + +labWait: + mov edx, 1 + xor eax, eax + lock cmpxchg dword ptr[rdi], edx + jnz short labWait + + xor rcx, rcx + xor rdx, rdx + call %GC_COLLECT + +end + +// ; system full collect +inline %2CFh + + mov rdi, data : %CORE_GC_TABLE + gc_lock + +labWait: + mov edx, 1 + xor eax, eax + lock cmpxchg dword ptr[rdi], edx + jnz short labWait + + xor rcx, rcx + mov edx, 1 + call %GC_COLLECT + +end + +// ; system 3 (thread startup) +inline %3CFh + + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, gs:[58h] + mov rax, [rcx + rax * 8] + mov rdi, data : %CORE_THREAD_TABLE + tt_slots + shl rdx, 4 + mov [rdi + rdx], rax + shr rdx, 4 + + mov [rax + tt_stack_root], rsp + +end + +// ; system startup +inline %4CFh + + finit + + mov rax, rsp + call %PREPARE + +end + +// ; system : enter GC critical section +inline %6CFh + + mov rdi, data : %CORE_GC_TABLE + gc_lock + mov ecx, 1 +labWait: + xor eax, eax + lock cmpxchg dword ptr[rdi], ecx + jnz short labWait + +end + +// ; system : leave GC critical section +inline %7CFh + + // ; GCXT: clear sync field + mov rdi, data : %CORE_GC_TABLE + gc_lock + mov ecx, 0FFFFFFFFh + + // ; GCXT: free lock + // ; could we use mov [esi], 0 instead? + lock xadd [rdi], ecx + +end + +// ; xhookdpr +inline %0E6h + + // ; GCXT: get current thread frame + mov rax, [data : %CORE_TLS_INDEX] + mov rcx, gs:[58h] + lea rdi, [rbp + __arg32_1] + mov rax, [rcx+rax*8] + + mov rcx, [rax + et_current] + mov [rdi + es_catch_frame], rbp + mov [rdi + es_prev_struct], rcx + mov [rdi + es_catch_level], rsp + mov rcx, __ptr64_2 + mov [rdi + es_catch_addr], rcx + + mov [rax + et_current], rdi + +end diff --git a/asm/ppc64le/core60.asm b/asm/ppc64le/core60.asm index b1137dd299..0a894662b5 100644 --- a/asm/ppc64le/core60.asm +++ b/asm/ppc64le/core60.asm @@ -3206,6 +3206,19 @@ inline % 0ECh end +// ; vjumpmr +inline % 6ECh + + ld r16, -elVMTOffset(r15) + ld r17, -elVMTSizeOffset(r16) + sldi r17, r17, 4 + addi r16, r16, r17 + ld r17, __arg16_1(r16) + mtctr r17 // ; put code address into ctr + bctr // ; and jump to it + +end + // ; jumpmr inline %0EDh @@ -4531,6 +4544,254 @@ labNextBaseClass: end +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 06FBh + + std r3, 0(r1) // ; saving arg0 +//; lea rax, [rsp + __n_2] + addi r17, r1, __n16_2 + std r4, 8(r1) // ; saving arg1 + + addi r17, r17, -8 // ; HOTFIX : caller address is not in the stack + +//; mov rsi, __ptr64_2 + ld r21, toc_rdata(r2) + addis r21, r21, __disp32hi_2 + addi r21, r21, __disp32lo_2 + +//; xor edx, edx + li r25, 0 +//; mov rbx, [rsi] // ; message from overload list + ld r22, 0(r21) //;!! + +labNextOverloadlist: +//; mov r9, mdata : %0 + ld r24, toc_mdata(r2) + +//; shr ebx, ACTION_ORDER + srdi r22, r22, ACTION_ORDER +//; lea r13, [rbx*8] + sldi r23, r22, 4 + +//; mov r13, [r9 + r13 * 2 + 8] + add r23, r23, r24 + ld r23, 8(r23) +//; mov ecx, __n_1 + li r16, __n16_1 +//; lea rbx, [r13 - 8] + addi r22, r23, -8 + +labNextParam: +//; sub ecx, 1 + addi r16, r16, -1 +//; jnz short labMatching + cmpwi r16,0 + bne labMatching + + sldi r23, r25, 4 + add r25, r21, r23 + + ld r23, 8(r25) + ld r14, 0(r25) + ld r16, -elVMTOffset(r15) + ld r20, -elVMTSizeOffset(r16) + sldi r20, r20, 4 + add r16, r16, r20 + add r20, r16, r23 + ld r0, 8(r20) + mtctr r0 + bctr + +labMatching: +//; mov rdi, [rax + rcx * 8] + sldi r19, r16, 3 + add r18, r19, r17 + ld r18, 0(r18) + + //; check nil +//; mov rsi, rdata : %VOIDPTR + elObjectOffset + ld r20, toc_rdata(r2) + addis r20, r20, rdata_disp32hi : %VOIDPTR + addi r20, r20, rdata_disp32lo : %VOIDPTR + addi r20, r20, elObjectOffset +//; test rdi, rdi + cmpwi r18,0 + +//; cmovz rdi, rsi + iseleq r18, r20, r18 + +//; mov rdi, [rdi - elVMTOffset] + ld r18, -elVMTOffset(r18) +//; mov rsi, [rbx + rcx * 8] + add r20, r22, r19 + ld r20, 0(r20) + +labNextBaseClass: +//; cmp rsi, rdi + cmp r20, r18 +//; jz labNextParam + beq labNextParam +//; mov rdi, [rdi - elPackageOffset] + ld r18, -elPackageOffset(r18) +//; and rdi, rdi + cmpwi r18, 0 +//; jnz short labNextBaseClass + bne labNextBaseClass + +//; add rdx, 1 + addi r25, r25, 1 +//; mov r13, __ptr32_2 + mr r23, r21 + +//; lea r9, [rdx * 8] + sldi r24, r25, 4 + +//; mov rbx, [r13 + r9 * 2] // ; message from overload list + add r22, r24, r23 + ld r22, 0(r22) + +//; and rbx, rbx + cmpwi r22, 0 +//; jnz labNextOverloadlist + bne labNextOverloadlist + +end + +// ; dispatchmr +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 0BFBh + + std r3, 0(r1) // ; saving arg0 +//; lea rax, [rsp + __n_2] + addi r17, r1, __n16_2 + std r4, 8(r1) // ; saving arg1 + + addi r17, r17, -8 // ; HOTFIX : caller address is not in the stack + +//; mov rsi, __ptr64_2 + ld r21, toc_rdata(r2) + addis r21, r21, __disp32hi_2 + addi r21, r21, __disp32lo_2 + +//; xor edx, edx + li r25, 0 + li r16, 0 + + // ; count the number of args + mr r22, r17 + li r23, 0 + addi r23, r23, -1 // ; define the terminator +labCountParam: + addi r22, r22, 8 + ld r24, 0(r22) + addi r16, r16, 1 + cmp r24, r23 + bne labCountParam + mr r17, r16 + +//; mov rbx, [rsi] // ; message from overload list + ld r22, 0(r21) //;!! + +labNextOverloadlist: +//; mov r9, mdata : %0 + ld r24, toc_mdata(r2) + +//; shr ebx, ACTION_ORDER + srdi r22, r22, ACTION_ORDER +//; lea r13, [rbx*8] + sldi r23, r22, 4 + +//; mov r13, [r9 + r13 * 2 + 8] + add r23, r23, r24 + ld r23, 8(r23) +//; mov ecx, __n_1 + li r16, __n16_1 +//; lea rbx, [r13 - 8] + addi r22, r23, -8 + mr r26, r22 + +labNextParam: +//; add ecx, 1 + addi r16, r16, 1 +//; jnz short labMatching + cmpwi r16,0 + bne labMatching + + sldi r23, r25, 4 + add r25, r21, r23 + + ld r23, 8(r25) + ld r14, 0(r25) + + ld r16, -elVMTOffset(r15) + ld r20, -elVMTSizeOffset(r16) + sldi r20, r20, 4 + add r16, r16, r20 + add r20, r16, r23 + ld r0, 8(r20) + mtctr r0 + bctr + +labMatching: + addi r20, r26, 8 + ld r18, 0(r20) + cmpwi r18, 0 + iseleq r26, r26, r20 + +//; mov rdi, [rax + rcx * 8] + sldi r19, r16, 3 + add r18, r19, r17 + ld r18, 0(r18) + + //; check nil +//; mov rsi, rdata : %VOIDPTR + elObjectOffset + ld r20, toc_rdata(r2) + addis r20, r20, rdata_disp32hi : %VOIDPTR + addi r20, r20, rdata_disp32lo : %VOIDPTR + addi r20, r20, elObjectOffset +//; test rdi, rdi + cmpwi r18,0 + +//; cmovz rdi, rsi + iseleq r18, r20, r18 + +//; mov rdi, [rdi - elVMTOffset] + ld r18, -elVMTOffset(r18) +//; mov rsi, [rbx + rcx * 8] + ld r20, 0(r26) + +labNextBaseClass: +//; cmp rsi, rdi + cmp r20, r18 +//; jz labNextParam + beq labNextParam +//; mov rdi, [rdi - elPackageOffset] + ld r18, -elPackageOffset(r18) +//; and rdi, rdi + cmpwi r18, 0 +//; jnz short labNextBaseClass + bne labNextBaseClass + +//; add rdx, 1 + addi r25, r25, 1 +//; mov r13, __ptr32_2 + mr r23, r21 + +//; lea r9, [rdx * 8] + sldi r24, r25, 4 + +//; mov rbx, [r13 + r9 * 2] // ; message from overload list + add r22, r24, r23 + ld r22, 0(r22) + +//; and rbx, rbx + cmpwi r22, 0 +//; jnz labNextOverloadlist + bne labNextOverloadlist + +end + // ; vcallmr inline % 0FCh @@ -4542,6 +4803,20 @@ inline % 0FCh end +// ; vcallmr +inline % 6FCh + + ld r16, -elVMTOffset(r15) + ld r17, -elVMTSizeOffset(r16) + sldi r17, r17, 4 + addi r16, r16, __arg16_1 + addi r16, r16, r17 + ld r17, 8(r16) + mtctr r17 // ; put code address into ctr + bctrl // ; and call it + +end + // ; callmr inline %0FDh diff --git a/asm/x32/core60.asm b/asm/x32/core60.asm index 2143e7f6a2..937bcdf237 100644 --- a/asm/x32/core60.asm +++ b/asm/x32/core60.asm @@ -3012,6 +3012,17 @@ inline %0ECh end +// ; vjumpmr (alt mode) +inline %06ECh + + mov eax, [ebx - elVMTOffset] + mov edi, [eax - elVMTSizeOffset] + lea eax, [eax + edi * 8] + mov eax, [eax + __arg32_1] + jmp eax + +end + // ; jumpmr inline %0EDh @@ -4258,6 +4269,155 @@ labNextBaseClass: end +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 6FBh + + mov [esp+4], esi // ; saving arg0 + lea eax, [esp + __n_2] + + mov esi, __ptr32_2 + push ebx + xor edx, edx + mov ebx, [esi] // ; message from overload list + +labNextOverloadlist: + shr ebx, ACTION_ORDER + mov edi, mdata : %0 + mov ebx, [edi + ebx * 8 + 4] + mov ecx, __n_1 + lea ebx, [ebx - 4] + +labNextParam: + sub ecx, 1 + jnz short labMatching + + mov esi, __ptr32_2 + pop ebx + mov eax, [esi + edx * 8 + 4] + mov edx, [esi + edx * 8] + mov ecx, [ebx - elVMTOffset] + mov edi, [ecx - elVMTSizeOffset] + lea ecx, [ecx + edi*8] + mov esi, [esp+4] // ; restore arg0 + jmp [ecx + eax + 4] + +labMatching: + mov edi, [eax + ecx * 4] + + //; check nil + mov esi, rdata : %VOIDPTR + elObjectOffset + test edi, edi + cmovz edi, esi + + mov edi, [edi - elVMTOffset] + mov esi, [ebx + ecx * 4] + +labNextBaseClass: + cmp esi, edi + jz labNextParam + mov edi, [edi - elPackageOffset] + and edi, edi + jnz short labNextBaseClass + + mov esi, __ptr32_2 + add edx, 1 + mov ebx, [esi + edx * 8] // ; message from overload list + and ebx, ebx + jnz labNextOverloadlist + + pop ebx + mov esi, [esp+4] // ; restore arg0 + mov edx, __arg32_1 + +end + +// ; dispatchmr (alt mode) +// ; NOTE : __arg32_1 - message; __n_1 - arg count; __ptr32_2 - list, __n_2 - argument list offset +inline % 0BFBh + + mov [esp+4], esi // ; saving arg0 + xor ecx, ecx + lea eax, [esp + __n_2] + push ecx + push ecx + push ebx + mov ebx, eax + +labCountParam: + lea ebx, [ebx+4] + cmp [ebx], -1 + lea ecx, [ecx+1] + jnz short labCountParam + mov [esp+4], ecx + + mov esi, __ptr32_2 + xor edx, edx + mov ebx, [esi] // ; message from overload list + +labNextOverloadlist: + shr ebx, ACTION_ORDER + mov edi, mdata : %0 + mov ebx, [edi + ebx * 8 + 4] + xor ecx, ecx + + lea ebx, [ebx - 4] + mov [esp+8], ebx + +labNextParam: + add ecx, 1 + cmp ecx, [esp+4] + jnz short labMatching + + mov esi, __ptr32_2 + pop ebx + mov eax, [esi + edx * 8 + 4] + add esp, 8 + mov edx, [esi + edx * 8] + mov ecx, [ebx - elVMTOffset] + mov edi, [ecx - elVMTSizeOffset] + lea ecx, [ecx + edi*8] + mov esi, [esp+4] // ; restore arg0 + jmp [ecx + eax + 4] + +labMatching: + mov esi, [esp+8] + lea edi, [esi+4] + cmp [edi], 0 + cmovnz esi, edi + mov [esp+8], esi + + mov edi, [eax + ecx * 4] + + //; check nil + mov esi, rdata : %VOIDPTR + elObjectOffset + test edi, edi + cmovz edi, esi + + mov edi, [edi - elVMTOffset] + mov esi, [esp+8] + mov esi, [esi] + +labNextBaseClass: + cmp esi, edi + jz labNextParam + mov edi, [edi - elPackageOffset] + and edi, edi + jnz short labNextBaseClass + + mov esi, __ptr32_2 + add edx, 1 + mov ebx, [esi + edx * 8] // ; message from overload list + and ebx, ebx + jnz labNextOverloadlist + + pop ebx + add esp, 8 + mov edx, __arg32_1 + mov esi, [esp+4] // ; restore arg0 + +end + // ; vcallmr inline %0FCh @@ -4267,6 +4427,17 @@ inline %0FCh end +// ; vcallmr +inline %06FCh + + mov eax, [ebx - elVMTOffset] + mov ecx, __arg32_1 + mov edi, [eax - elVMTSizeOffset] + lea eax, [eax + edi * 8] + call [eax + ecx + 4] + +end + // ; callmr inline %0FDh diff --git a/bin/templates/lib60.cfg b/bin/templates/lib60.cfg index 77327bc062..1fd7eca53c 100644 --- a/bin/templates/lib60.cfg +++ b/bin/templates/lib60.cfg @@ -51,6 +51,8 @@ system'BaseLazyExpression system'Nullable#1 system'UnsafePointer + system'threading'Task system'YieldStateEnumerator + system'threading'AsyncStateEnumerator \ No newline at end of file diff --git a/build/aarch64/build_package_arm64.script b/build/aarch64/build_package_arm64.script index bda0633701..8cef692b95 100755 --- a/build/aarch64/build_package_arm64.script +++ b/build/aarch64/build_package_arm64.script @@ -1,5 +1,5 @@ #!/bin/bash -RELEASE=elena-6.3.2.aarch64-linux +RELEASE=elena-6.4.3.aarch64-linux mkdir -p /usr/share/elena mkdir -p /etc/elena/ diff --git a/build/aarch64/control b/build/aarch64/control index 73eae767ae..45ee120449 100644 --- a/build/aarch64/control +++ b/build/aarch64/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.3.2 +Version: 6.4.3 Architecture: aarch64 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/amd64/build_package_amd64.script b/build/amd64/build_package_amd64.script index 9ac91e782f..4a670f9759 100755 --- a/build/amd64/build_package_amd64.script +++ b/build/amd64/build_package_amd64.script @@ -1,5 +1,5 @@ #!/bin/bash -RELEASE=elena-6.3.2.amd64-linux +RELEASE=elena-6.4.3.amd64-linux mkdir -p /usr/share/elena mkdir -p /etc/elena/ diff --git a/build/amd64/control b/build/amd64/control index 47be7c9ee3..0cb114e6da 100644 --- a/build/amd64/control +++ b/build/amd64/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.3.2 +Version: 6.4.3 Architecture: amd64 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/elena_inno.iss b/build/elena_inno.iss index b85180a93c..793ddb0797 100644 --- a/build/elena_inno.iss +++ b/build/elena_inno.iss @@ -7,8 +7,8 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{3CAA69D3-0F98-44B1-A73E-E864BA51D5BD} AppName=ELENA Programming Language -AppVersion=6.3.2 -;AppVerName=ELENA Programming Language 6.2.0 +AppVersion=6.4.3 +;AppVerName=ELENA Programming Language 6.4.0 AppPublisher=Alexey Rakov AppPublisherURL=http://github.com/ELENA-LANG/elena-lang AppSupportURL=http://github.com/ELENA-LANG/elena-lang @@ -18,7 +18,7 @@ DefaultGroupName=ELENA Programming Language AllowNoIcons=yes LicenseFile=..\doc\license InfoAfterFile=..\CHANGELOG.md -OutputBaseFilename=elena-lang-6.3.2.x86-win-setup +OutputBaseFilename=elena-lang-6.4.3.x86-win-setup Compression=lzma SolidCompression=yes ChangesEnvironment=yes diff --git a/build/i386/build_package_i386.script b/build/i386/build_package_i386.script index a031a6778a..8c07d866a1 100755 --- a/build/i386/build_package_i386.script +++ b/build/i386/build_package_i386.script @@ -1,5 +1,5 @@ #!/bin/bash -RELEASE=elena-6.3.2.i386-linux +RELEASE=elena-6.4.3.i386-linux mkdir -p /usr/share/elena mkdir -p /etc/elena/ diff --git a/build/i386/control b/build/i386/control index d60443cf8c..cbe7bbbd76 100644 --- a/build/i386/control +++ b/build/i386/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.3.2 +Version: 6.4.3 Architecture: i386 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/ppc64le/build_package_ppc64le.script b/build/ppc64le/build_package_ppc64le.script index e39d3ea9ed..0ad1abd82d 100755 --- a/build/ppc64le/build_package_ppc64le.script +++ b/build/ppc64le/build_package_ppc64le.script @@ -1,5 +1,5 @@ #!/bin/bash -RELEASE=elena-6.3.2.ppc64le-linux +RELEASE=elena-6.4.3.ppc64le-linux mkdir -p /usr/share/elena mkdir -p /etc/elena/ diff --git a/build/ppc64le/control b/build/ppc64le/control index d27f87f8da..8fff55adc0 100644 --- a/build/ppc64le/control +++ b/build/ppc64le/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.3.2 +Version: 6.4.3 Architecture: ppc64le Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/dat/api2html/api2html.bat b/dat/api2html/api2html.bat index 3fb5e85f92..44b6a6a14a 100644 --- a/dat/api2html/api2html.bat +++ b/dat/api2html/api2html.bat @@ -4,12 +4,14 @@ ..\..\bin\ldoc system'routines'stex ..\..\bin\ldoc system'runtime ..\..\bin\ldoc system'threading +..\..\bin\ldoc system'io'threading ..\..\bin\ldoc system'dynamic ..\..\bin\ldoc system'drawing ..\..\bin\ldoc system'winforms ..\..\bin\ldoc system'net ..\..\bin\ldoc extensions ..\..\bin\ldoc extensions'routines +..\..\bin\ldoc extensions'routines'stex ..\..\bin\ldoc extensions'scripting ..\..\bin\ldoc extensions'dynamic ..\..\bin\ldoc extensions'io diff --git a/dat/sg/syntax60.txt b/dat/sg/syntax60.txt index 719c55f671..9c05d0b931 100644 --- a/dat/sg/syntax60.txt +++ b/dat/sg/syntax60.txt @@ -313,15 +313,7 @@ ROOT_EXPRESSION ::= | L9_OOP | LESS ^OBJECT TEMPLATE_ARG { "," TEMPLATE_ARG }* ">" ^TEMPLATE_TYPE { "{" NESTED_EXPRESSION ^NESTED L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? - | identifier ^OBJECT { ASSIGN ASSIGN_R }? - | BRACKET ^OBJECT FUNCTION_R L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? - | L3_OOP L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? - | L4_OOP L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? - | L5_OOP L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? - | L6_OOP L7_OP* L8_OP? L9_OP? - | L7_OOP L7_OP* L8_OP? L9_OP? - | L8_OOP - | L9_OOP + | O_R | eps } | "=>" ^OBJECT { SWITCH_OPTION+ SWITCH_LAST_OPTION? } ^SWITCH_OPERATION @@ -330,7 +322,7 @@ ROOT_EXPRESSION ::= | T_EXPRESSION T_EXPRESSION_F ^ TEMPLATE_BLOCK | eps ^OBJECT } - | { reference | global } ^OBJECT L2_OP* L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? + | { reference | global } { O_R | eps ^OBJECT } | { string | integer | hexinteger | long | real | constant | character | wide } ^OBJECT L_F | "*" SINGLE_EXPRESSION ^VALUE_OPERATION L2_OP* L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? | "&" SINGLE_EXPRESSION ^CLOSURE_OPERATION L2_OP* L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? @@ -339,7 +331,7 @@ ROOT_EXPRESSION ::= | "$break" ^BREAK_OPERATION | "$continue" ^CONTINUE_OPERATION | "$yield" EXPRESSION ^YIELD_OPERATION - | "$async" EXPRESSION ^ASYNC_OPERATION + | "$await" EXPRESSION ^ASYNC_OPERATION | BRACKET SUB_EXPRESSION { "=>" { SWITCH_OPTION+ SWITCH_LAST_OPTION? } ^SWITCH_OPERATION | L2_OP+ L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? @@ -443,7 +435,7 @@ NESTED_ROOT_EXPRESSION ::= | "$break" ^BREAK_OPERATION | "$continue" ^CONTINUE_OPERATION | "$yield" EXPRESSION ^YIELD_OPERATION - | "$async" EXPRESSION ^ASYNC_OPERATION; + | "$await" EXPRESSION ^ASYNC_OPERATION; EXPRESSION ::= identifier { @@ -551,6 +543,7 @@ EXPRESSION ::= | "$reference" SINGLE_EXPRESSION ^REFER_OPERATION | "$len" SINGLE_EXPRESSION ^LEN_OPERATION | "$size" SINGLE_EXPRESSION ^SIZE_OPERATION + | "$await" EXPRESSION ^ASYNC_OPERATION | "{" BLOCK ^CLOSURE L2_OP* L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? | BRACKET SUB_EXPRESSION { L2_OP+ L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? @@ -989,6 +982,17 @@ L3_SINGLE_EXPRESSION ::= | ")" "{" ^ PARAMETER BLOCK ^CLOSURE ^EXPRESSION }; +O_R ::= + identifier ^OBJECT { ASSIGN ASSIGN_R }? + | BRACKET ^OBJECT FUNCTION_R L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? + | L3_OOP L3_OP* L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? + | L4_OOP L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? + | L5_OOP L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? + | L6_OOP L7_OP* L8_OP? L9_OP? + | L7_OOP L7_OP* L8_OP? L9_OP? + | L8_OOP + | L9_OOP; + RI_F ::= DOT ^MESSAGE_OPERATION MESSAGE { L3_F | eps ^PROPERTY_OPERATION } | STAR ^MESSAGE_OPERATION L4_EXPRESSION ^MUL_OPERATION L4_OP* L5_OP* L6_OP? L7_OP* L8_OP? L9_OP? diff --git a/doc/api/algorithms-summary.html b/doc/api/algorithms-summary.html index eb674cc477..ac715f8399 100644 --- a/doc/api/algorithms-summary.html +++ b/doc/api/algorithms-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module algorithms +ELENA Standard Library 6.4: Module algorithms diff --git a/doc/api/algorithms.html b/doc/api/algorithms.html index bcead67cc9..7b9cc8a784 100644 --- a/doc/api/algorithms.html +++ b/doc/api/algorithms.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module algorithms +ELENA Standard Library 6.4: Module algorithms diff --git a/doc/api/cellular-summary.html b/doc/api/cellular-summary.html index 13ac71be0f..0807726cc8 100644 --- a/doc/api/cellular-summary.html +++ b/doc/api/cellular-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module cellular +ELENA Standard Library 6.4: Module cellular diff --git a/doc/api/cellular.html b/doc/api/cellular.html index 9702935443..9c75c8cb39 100644 --- a/doc/api/cellular.html +++ b/doc/api/cellular.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module cellular +ELENA Standard Library 6.4: Module cellular diff --git a/doc/api/extensions-dynamic-summary.html b/doc/api/extensions-dynamic-summary.html index e2ba67a16c..0ed19b6cef 100644 --- a/doc/api/extensions-dynamic-summary.html +++ b/doc/api/extensions-dynamic-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'dynamic +ELENA Standard Library 6.4: Module extensions'dynamic diff --git a/doc/api/extensions-dynamic.html b/doc/api/extensions-dynamic.html index 39334b9304..cba653fb0a 100644 --- a/doc/api/extensions-dynamic.html +++ b/doc/api/extensions-dynamic.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'dynamic +ELENA Standard Library 6.4: Module extensions'dynamic diff --git a/doc/api/extensions-io-summary.html b/doc/api/extensions-io-summary.html index 690d885e5a..c912ebd13a 100644 --- a/doc/api/extensions-io-summary.html +++ b/doc/api/extensions-io-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 4.1: Module extensions'io +ELENA Standard Library 6.4: Module extensions'io @@ -19,7 +19,7 @@
-ELENA Standard Library
4.1 +ELENA Standard Library
6.3
@@ -36,19 +36,37 @@

  • -Extended Class Summary +Class Summary
    - + + + + + + + + +
    Extended class nameClass name Description
    -Object +BufferWriter
    -Object
    +public class BufferWriter +
    +ByteArrayReader + +
    +public class ByteArrayReader
    +
    +ByteArrayWriter + +
    +public class ByteArrayWriter
    @@ -66,7 +84,7 @@

    -ELENA Standard Library
    4.1 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-io.html b/doc/api/extensions-io.html index d2d95693dc..ebcb937e0f 100644 --- a/doc/api/extensions-io.html +++ b/doc/api/extensions-io.html @@ -2,7 +2,7 @@ -ELENA Standard Library 4.1: Module extensions'io +ELENA Standard Library 6.4: Module extensions'io @@ -19,30 +19,136 @@
    -ELENA Standard Library
    4.1 +ELENA Standard Library
    6.3
    - + - +
    -system'
    -

    Object

    +extensions'io'
    +

    BufferWriter



    -Object
    +public class BufferWriter
    -
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + + + + + +
      Modifier and TypeField
      + +IntNumber +_position +
      + + +_buffer +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +internal   +flush(BufferWriter bufferWriter, BinaryWriter externalWriter) + +
      +
    • +
    +
    • - +

      Property Summary

      + + + + + + + + + +
      Modifier and TypeProperty
      + +get  Object +Source() +
      +
    • +
    + + + +
    +
    + + + +
    +
    +extensions'io'
    +

    ByteArrayReader

    +
    +
    +
    +
    +
    +
    +public class ByteArrayReader
    +
    +
    + + + + + + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  Object +Source() +
      + +get  BoolValue +Available() +
      +
    • +
    + + +
    +
    + + + +
    +
    +extensions'io'
    +

    ByteArrayWriter

    +
    +
    +
    +
    +
    +public class ByteArrayWriter
    +
    +
    + + + + + + +
      +
    • +

      Property Summary

      + + + + + + + + + +
      Modifier and TypeProperty
      + +get  Object +Source() +
      +
    • +
    + +
    @@ -88,7 +494,7 @@

    Extension Summary

    -ELENA Standard Library
    4.1 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-math-summary.html b/doc/api/extensions-math-summary.html index edc3de4c54..0602779bc0 100644 --- a/doc/api/extensions-math-summary.html +++ b/doc/api/extensions-math-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions'math +ELENA Standard Library 6.4: Module extensions'math @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -266,7 +266,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-math.html b/doc/api/extensions-math.html index 8a22172f25..b9bdb474bf 100644 --- a/doc/api/extensions-math.html +++ b/doc/api/extensions-math.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions'math +ELENA Standard Library 6.4: Module extensions'math @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -1299,7 +1299,7 @@

    Extension Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-routines-summary.html b/doc/api/extensions-routines-summary.html index 860f3ded3a..c8f0f8eec8 100644 --- a/doc/api/extensions-routines-summary.html +++ b/doc/api/extensions-routines-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'routines +ELENA Standard Library 6.4: Module extensions'routines diff --git a/doc/api/extensions-routines.html b/doc/api/extensions-routines.html index b0e75619f6..356a428802 100644 --- a/doc/api/extensions-routines.html +++ b/doc/api/extensions-routines.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'routines +ELENA Standard Library 6.4: Module extensions'routines diff --git a/doc/api/extensions-scripting-summary.html b/doc/api/extensions-scripting-summary.html index 40ca57b105..aff45a3cc2 100644 --- a/doc/api/extensions-scripting-summary.html +++ b/doc/api/extensions-scripting-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'scripting +ELENA Standard Library 6.4: Module extensions'scripting diff --git a/doc/api/extensions-scripting.html b/doc/api/extensions-scripting.html index 5c2268bc84..580597e947 100644 --- a/doc/api/extensions-scripting.html +++ b/doc/api/extensions-scripting.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module extensions'scripting +ELENA Standard Library 6.4: Module extensions'scripting diff --git a/doc/api/extensions-summary.html b/doc/api/extensions-summary.html index e30b2c6687..98533435c2 100644 --- a/doc/api/extensions-summary.html +++ b/doc/api/extensions-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions +ELENA Standard Library 6.4: Module extensions @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -154,24 +154,33 @@

    -program_arguments +Program_arguments
    -program_arguments
    +Program_arguments -programLoop +program_arguments
    -programLoop
    +program_arguments +ProgramLoop + + +
    +ProgramLoop
    + + + + randomGenerator @@ -217,6 +226,15 @@

    public class Object + + +String + + +
    +public class String
    + +

  • @@ -232,7 +250,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-text-summary.html b/doc/api/extensions-text-summary.html index 9cb389b31f..4442ccfec9 100644 --- a/doc/api/extensions-text-summary.html +++ b/doc/api/extensions-text-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions'text +ELENA Standard Library 6.4: Module extensions'text @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -120,7 +120,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions-text.html b/doc/api/extensions-text.html index 87fbba7af4..d96bfa2b4d 100644 --- a/doc/api/extensions-text.html +++ b/doc/api/extensions-text.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions'text +ELENA Standard Library 6.4: Module extensions'text @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -999,6 +999,10 @@

    TokenEnumerator

    • @@ -1283,7 +1289,7 @@

      Method Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/extensions.html b/doc/api/extensions.html index 7788ecd6ca..b3415c2375 100644 --- a/doc/api/extensions.html +++ b/doc/api/extensions.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module extensions +ELENA Standard Library 6.4: Module extensions @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -148,7 +148,7 @@

    Method Summary

    -ifTrue(b) +ifNotFailed(Func f) @@ -157,7 +157,7 @@

    Method Summary

    -ifFalse(b) +ifTrue(b) @@ -166,7 +166,7 @@

    Method Summary

    -ifNil(b) +ifFalse(b) @@ -175,6 +175,15 @@

    Method Summary

    +ifNil(b) + + + + + + + + ifInstanceOf(object, class) @@ -780,9 +789,9 @@

    Constructor / Static Method Summary

    -RandomGenerator +internal  RandomGenerator
    -xtensions$$#constructor() +new() @@ -985,6 +994,43 @@

    Method Summary


    + + + +
    +
    +extensions'
    +

    Program_arguments

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public   +Program_arguments +
      +
    • +
    +
    +
    +
    @@ -1022,13 +1068,13 @@

    Symbol Summary


    - +
    extensions'
    -

    programLoop

    +

    ProgramLoop

    @@ -1051,7 +1097,7 @@

    Symbol Summary

    public   -programLoop +ProgramLoop @@ -1384,6 +1430,24 @@

    Extension Summary

    +printWide(params Object[] list) + + + + + + + + +printWideLine(params Object[] list) + + + + + + + + dispatch() @@ -1492,7 +1556,7 @@

    Extension Summary

    -assertTrue() +getAtOrDefault(IntNumber index, Object default) @@ -1501,7 +1565,7 @@

    Extension Summary

    -assertFalse() +assertTrue() @@ -1510,6 +1574,15 @@

    Extension Summary

    +assertFalse() + + + + + + + + randomize(IntNumber count) @@ -1519,6 +1592,54 @@

    Extension Summary


    + + + +
    +
    +system'
    +

    String

    +
    +
    +
    +
    +
    +
    +public class String
    +
    +
    + +
      +
    • +

      Extension Summary

      + + + + + + + + + + + + + +
      Modifier and TypeExtension Method
      + + +dispatch() + +
      + +String +interpolate(params Object[] args) + +
      +
    • +
    +
    +
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/forms-summary.html b/doc/api/forms-summary.html index 9443d3b017..09c83beefc 100644 --- a/doc/api/forms-summary.html +++ b/doc/api/forms-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module forms +ELENA Standard Library 6.4: Module forms diff --git a/doc/api/forms.html b/doc/api/forms.html index 2e6a3980d6..a1bc7e6f18 100644 --- a/doc/api/forms.html +++ b/doc/api/forms.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module forms +ELENA Standard Library 6.4: Module forms diff --git a/doc/api/index.html b/doc/api/index.html index 9ba1bede3f..c6eaa4478c 100644 --- a/doc/api/index.html +++ b/doc/api/index.html @@ -109,27 +109,6 @@

    -
  • - -
    -system'collections'threadsafe Package -
    - - - - - - - - -
    ModuleDescription
    -system'collections'threadsafe - -
    -Provides classes to work with thread-safe collections -
    -
  • -
  • diff --git a/doc/api/ltests-summary.html b/doc/api/ltests-summary.html index 3292f9ea65..dbc111010a 100644 --- a/doc/api/ltests-summary.html +++ b/doc/api/ltests-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module ltests +ELENA Standard Library 6.4: Module ltests diff --git a/doc/api/ltests.html b/doc/api/ltests.html index 91fd5ccd3d..b1ad85e499 100644 --- a/doc/api/ltests.html +++ b/doc/api/ltests.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module ltests +ELENA Standard Library 6.4: Module ltests diff --git a/doc/api/net-summary.html b/doc/api/net-summary.html index 5f40ca9eb5..24ffb3f829 100644 --- a/doc/api/net-summary.html +++ b/doc/api/net-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module net +ELENA Standard Library 6.4: Module net diff --git a/doc/api/net.html b/doc/api/net.html index c973472e25..2e71a7b317 100644 --- a/doc/api/net.html +++ b/doc/api/net.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module net +ELENA Standard Library 6.4: Module net diff --git a/doc/api/sqlite-summary.html b/doc/api/sqlite-summary.html index e8c97e3e31..e0d831184a 100644 --- a/doc/api/sqlite-summary.html +++ b/doc/api/sqlite-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module sqlite +ELENA Standard Library 6.4: Module sqlite @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -120,7 +120,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/sqlite.html b/doc/api/sqlite.html index e68161bbc9..b79fa1bdb6 100644 --- a/doc/api/sqlite.html +++ b/doc/api/sqlite.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module sqlite +ELENA Standard Library 6.4: Module sqlite @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -1078,7 +1078,7 @@

    Method Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-calendar-summary.html b/doc/api/system-calendar-summary.html index 412552a544..7dd27c5e75 100644 --- a/doc/api/system-calendar-summary.html +++ b/doc/api/system-calendar-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'calendar +ELENA Standard Library 6.4: Module system'calendar @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -109,6 +109,15 @@

    + + + + + + + +
    +Now + +
    +Now
    +
    utcNow @@ -116,6 +125,15 @@

    utcNow

    +UtcNow + +
    +UtcNow
    +
  • @@ -131,7 +149,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3

    diff --git a/doc/api/system-calendar.html b/doc/api/system-calendar.html index d559d66afb..065788ad5c 100644 --- a/doc/api/system-calendar.html +++ b/doc/api/system-calendar.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'calendar +ELENA Standard Library 6.4: Module system'calendar @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -1281,6 +1281,43 @@

    Symbol Summary


    + + + +
    +
    +system'calendar'
    +

    Now

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public  Date +Now +
      +
    • +
    +
    +
    +
    @@ -1318,6 +1355,43 @@

    Symbol Summary


    + + + +
    +
    +system'calendar'
    +

    UtcNow

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public  Date +UtcNow +
      +
    • +
    +
    +
    +
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-collections-summary.html b/doc/api/system-collections-summary.html index b3f729b7f1..aa9648c4e1 100644 --- a/doc/api/system-collections-summary.html +++ b/doc/api/system-collections-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'collections +ELENA Standard Library 6.4: Module system'collections @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -80,24 +80,6 @@

    -List<T1> - - -
    -public template List<T1>
    - - - - -Map<T1,T2> - - -
    -public template Map<T1,T2>
    - - - - Queue @@ -107,101 +89,56 @@

    -Queue<T1> +SortedArrayList
    -public template Queue<T1>
    +public class SortedArrayList -Stack +SortedList
    -public class Stack
    +public class SortedList -Stack<T1> +SortedListEnumerator
    -public template Stack<T1>
    +public class SortedListEnumerator -StackEnumerator +SortedListIndexer
    -public class StackEnumerator
    +public class SortedListIndexer -Tuple<T1> - - -
    -public template Tuple<T1>
    - - - - -Tuple<T1,T2> - - -
    -public template Tuple<T1,T2>
    - - - - -Tuple<T1,T2,T3> - - -
    -public template Tuple<T1,T2,T3>
    - - - - -Tuple<T1,T2,T3,T4> - - -
    -public template Tuple<T1,T2,T3,T4>
    - - - - -Tuple<T1,T2,T3,T4,T5> +Stack
    -public template Tuple<T1,T2,T3,T4,T5>
    +public class Stack -Tuple<T1,T2,T3,T4,T5,T6> - - -
    -public template Tuple<T1,T2,T3,T4,T5,T6>
    - - - - -VarTuple<T1,T2> +StackEnumerator
    -public template VarTuple<T1,T2>
    +public class StackEnumerator @@ -219,7 +156,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-collections-threadsafe-summary.html b/doc/api/system-collections-threadsafe-summary.html index b3c67e6003..57d420bd34 100644 --- a/doc/api/system-collections-threadsafe-summary.html +++ b/doc/api/system-collections-threadsafe-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'collections'threadsafe +ELENA Standard Library 6.4: Module system'collections'threadsafe @@ -44,33 +44,6 @@

    -Array<T1> - - -
    -public template Array<T1>
    - - - - -BaseEnumerator<T1> - - -
    -abstract public template BaseEnumerator<T1>
    - - - - -BaseIndexer<T1> - - -
    -abstract public template BaseIndexer<T1>
    - - - - ConcurrentQueue<T1> @@ -78,69 +51,6 @@

    public template ConcurrentQueue<T1> - - -Enumerable<T1> - - -
    -abstract public template Enumerable<T1>
    - - - - -Enumerator<T1> - - -
    -abstract public template Enumerator<T1>
    - - - - -Indexable<T1> - - -
    -abstract public template Indexable<T1>
    - - - - -Indexer<T1> - - -
    -abstract public template Indexer<T1>
    - - - - -List<T1> - - -
    -public template List<T1>
    - - - - -Queue<T1> - - -
    -public template Queue<T1>
    - - - - -Reference<T1> - - -
    -public template Reference<T1>
    - - diff --git a/doc/api/system-collections-threadsafe.html b/doc/api/system-collections-threadsafe.html index a8b6e6e173..b090a72636 100644 --- a/doc/api/system-collections-threadsafe.html +++ b/doc/api/system-collections-threadsafe.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'collections'threadsafe +ELENA Standard Library 6.4: Module system'collections'threadsafe @@ -23,1339 +23,20 @@ - - - -
    -
    -system'collections'threadsafe'
    -

    Array<T1>

    -
    -
    -
    -
    -
    -
    -public template Array<T1>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - -
      Modifier and TypeField
      - - -array -
      -
    • -
    - - - -
      -
    • -

      Static Property Summary

      - - - - - - - - - - - - - -
      Modifier and TypeStatic Property
      - -get  T1[] -Default() -
      - -get  T1[] -MinValue() -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - -
      Modifier and TypeProperty
      - -get  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -Enumerable -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - -Indexer<T1> -indexer() - -
      - - -at(n) - -
      - - -setAt(n, item) - -
      - -Enumerator<T1> -enumerator() - -
      - -T1 -at(IntNumber n) - -
      - - -setAt(IntNumber n, T1 item) - -
      - -T1[] -add(T1[] a) - -
      - -T1[] -add(T1[] a, IntNumber length) - -
      - -T1[] -clone() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    BaseEnumerator<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template BaseEnumerator<T1>
    -
    -
    - - - - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -Enumerator -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -BoolValue -next() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    BaseIndexer<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template BaseIndexer<T1>
    -
    -
    - - - - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get  BoolValue -Available() -
      - -get  IntNumber -Index() -
      - -set   -Index(IntNumber index) - -
      - -get  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -Indexer -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - - -appendIndex(IntNumber offs) - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    ConcurrentQueue<T1>

    -
    -
    -
    -
    -
    -
    -public template ConcurrentQueue<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'collections'threadsafe'ConcurrentQueue<T1>
      • -
      -
    • -
    - - - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -ConcurrentQueue<T1> -constructor() - -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get  IntNumber -Length() -
      - -get  Queue<T1> -Snapshot() -
      -Returns a copy of the queue
      -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -push(T1 object) - -
      - -T1 -pop() - -
      - - -clear() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    Enumerable<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Enumerable<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'collections'threadsafe'Enumerable<T1>
      • -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  Enumerator<T1> -enumerator() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    Enumerator<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Enumerator<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'collections'threadsafe'Enumerator<T1>
      • -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - -
      Modifier and TypeProperty
      - -get abstract  T1 -Value() -
      -Returns the current object
      -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -abstract  Enumerator -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  BoolValue -next() - -
      - -abstract   -reset() - -
      - -abstract   -enumerable() - -
      - -Enumerator<T1> -enumerator() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    Indexable<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Indexable<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'collections'threadsafe'Indexable<T1>
      • -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  Indexer<T1> -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    Indexer<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Indexer<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'collections'threadsafe'Indexer<T1>
      • -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get abstract  BoolValue -Available() -
      - -get abstract  T1 -Value() -
      - -set abstract   -Value(T1 value) - -
      - -get abstract  IntNumber -Index() -
      - -set abstract   -Index(IntNumber value) - -
      - -get abstract  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -abstract  Indexer -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract   -appendIndex(IntNumber index) - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    List<T1>

    -
    -
    -
    -
    -
    -
    -public template List<T1>
    -
    -
    - - - - - - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get  IntNumber -Length() -
      - -get  T1 -First() -
      - -get  T1[] -Value() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - -Enumerator<T1> -enumerator() - -
      - -T1 -at(IntNumber index) - -
      - - -setAt(IntNumber index, T1 object) - -
      - - -append(T1 object) - -
      - - -appendRange(Enumerator<T1> e) - -
      - - -insert(IntNumber index, T1 object) - -
      - - -insert(T1 object) - -
      - - -remove(IntNumber index) - -
      - - -clear() - -
      - - -trim(IntNumber pos) - -
      - -Indexer<T1> -indexer() - -
      - - -clone() - -
      -
    • -
    -
    -
    - +
    system'collections'threadsafe'
    -

    Queue<T1>

    +

    ConcurrentQueue<T1>



    -public template Queue<T1>
    +public template ConcurrentQueue<T1>
      @@ -1364,13 +45,7 @@

      Queue<T1>

      • -system'Enumerable<T1>
      • -
      • -
          -
        • -system'collections'threadsafe'Queue<T1>
        • -
        -
      • +system'collections'threadsafe'ConcurrentQueue<T1>
    @@ -1386,17 +61,17 @@

    Field Summary

    -List<T1> +Object
    -_array +_sync -Reference<system'IntNumber> +List<T1>
    -_top +_array @@ -1404,180 +79,15 @@

    Field Summary

    Reference<system'IntNumber> -_tale - - - - - - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -Queue<T1> -constructor() - -
      - -Queue<T1> -allocate(IntNumber capacity) - -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - -
      Modifier and TypeProperty
      - -get  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - -Enumerator<T1> -enumerator() - -
      - -BoolValue -isEmpty() - -
      - -BoolValue -isNotEmpty() - -
      - - -push(T1 object) - -
      - -T1 -peek() - +_top
      -T1 -pop() - -
      - - -clear() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'collections'threadsafe'
    -

    Reference<T1>

    -
    -
    -
    -
    -
    -
    -public template Reference<T1>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - +Reference<system'IntNumber>
      Modifier and TypeField
      - -T1 -value +_tale
      @@ -1595,12 +105,10 @@

      Constructor / Static Method Summary

      -Reference<T1> +ConcurrentQueue<T1> -constructor(T1 val) +constructor() -
      -Initializes a variable
      @@ -1618,44 +126,19 @@

      Property Summary

      -get  T1 +get  IntNumber
      -Value() -
      -Returns the variable value
      +Length() -set   - -Value(T1 val) - -
      -Set the variable value
      - - - -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - +get  Queue<T1>
      Modifier and TypeConversion Method
      - -T1 -cast() +Snapshot()
      -Returns the variable value
      +Returns a copy of the queue
      @@ -1673,23 +156,19 @@

      Method Summary

      -BoolValue + -equal(o) +push(T1 object) -
      -Returns true if o is equal to the variable value; otherwise, false
      -String +T1
      -toPrintable() +pop() -
      -Returns the value string representation
      @@ -1697,7 +176,7 @@

      Method Summary

      -dispatch() +clear() diff --git a/doc/api/system-collections.html b/doc/api/system-collections.html index 5649566ceb..88ef6d867f 100644 --- a/doc/api/system-collections.html +++ b/doc/api/system-collections.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'collections +ELENA Standard Library 6.4: Module system'collections @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -1052,20 +1052,20 @@

    Method Summary


    - +
    -system'
    -

    List<T1>

    +system'collections'
    +

    Queue



    -public template List<T1>
    +public class Queue
    + +
      +
    • +

      Property Summary

      + + + + +get internal  IntNumber +get internal  IntNumber +get  IntNumber
      Modifier and TypeProperty
      -List<T1> -constructor(IntNumber capacity) - +TopPointer()
      -List<T1> -constructor() - +TalePointer()
      -List<T1> -load(T1[] a, IntNumber index, IntNumber len) - +Length()
      @@ -1180,34 +1180,18 @@

      Constructor / Static Method Summary

      • -

        Property Summary

        +

        Conversion Summary

        - - - - - - - - - + +ArrayList
        Modifier and TypeProperty
        - -get  IntNumber -Length() -
        - -get  T1 -First() -Conversion Method
        -get  T1[] -Value() +cast()
        @@ -1225,7 +1209,7 @@

        Method Summary

        -Enumerator<T1> +Enumerator
        enumerator() @@ -1234,45 +1218,9 @@

        Method Summary

        -T1 - -at(IntNumber index) - - - - - - - - -setAt(IntNumber index, T1 object) - - - - - - - - -append(T1 object) - - - - - - - - -appendRange(Enumerator<T1> e) - - - - - - -insert(IntNumber index, T1 object) +push(object) @@ -1281,7 +1229,7 @@

        Method Summary

        -insert(T1 object) +peek() @@ -1290,7 +1238,7 @@

        Method Summary

        -remove(IntNumber index) +pop() @@ -1308,25 +1256,7 @@

        Method Summary

        -trim(IntNumber pos) - - - - - - -Indexer<T1> - -indexer() - - - - - - - - -clone() +shift(offset) @@ -1335,20 +1265,20 @@

        Method Summary


    - +
    -system'
    -

    Map<T1,T2>

    +system'collections'
    +

    SortedArrayList



    -public template Map<T1,T2>
    +public class SortedArrayList

    - +
    system'collections'
    -

    Queue

    +

    SortedList



    -public class Queue
    +public class SortedList
      @@ -1555,7 +1530,7 @@

      Queue

      • -system'collections'Queue
      • +system'collections'SortedList
    @@ -1573,9 +1548,9 @@

    Field Summary

    -ArrayList +SortedListItem
    -_list +_top @@ -1583,15 +1558,15 @@

    Field Summary

    Reference<system'IntNumber> -_top +_length -Reference<system'IntNumber> +Func<system'Object,system'Object,system'IntNumber>
    -_tale +_comparator @@ -1609,9 +1584,18 @@

    Constructor / Static Method Summary

    -Queue +SortedList -constructor() +new() + + + + + + +SortedList + +new(Func<system'Object,system'Object,system'IntNumber> comparator) @@ -1630,45 +1614,17 @@

    Property Summary

    -get internal  IntNumber - -TopPointer() - - - - - -get internal  IntNumber - -TalePointer() - - - - - get  IntNumber Length() - - - - -
      -
    • -

      Conversion Summary

      - - - - - - + +get internal  SortedListItem
      Modifier and TypeConversion Method
      -ArrayList -cast() +FirstItem()
      @@ -1697,16 +1653,16 @@

      Method Summary

      -push(object) +append(Object key, Object item) - +Object -peek() +at(IntNumber index) @@ -1715,16 +1671,16 @@

      Method Summary

      -pop() +setAt(IntNumber index, Object item) - +IntNumber -clear() +indexOfKey(Object key) @@ -1733,7 +1689,16 @@

      Method Summary

      -shift(offset) +removeAt(IntNumber index) + + + + + + +Indexer + +indexer() @@ -1742,20 +1707,20 @@

      Method Summary


    - +
    -system'
    -

    Queue<T1>

    +system'collections'
    +

    SortedListEnumerator



    -public template Queue<T1>
    +public class SortedListEnumerator

    - +
    system'collections'
    -

    Stack

    +

    SortedListIndexer



    -public class Stack
    +public class SortedListIndexer
    - -
      -
    • -

      Conversion Summary

      - - - - - - - +get   -
      Modifier and TypeConversion Method
      - -ArrayList -cast() +Value()
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - +set   +get  IntNumber +set   - - - - +get  IntNumber - - - +
      Modifier and TypeMethod
      -Enumerator -enumerator() +Value(value)
      -BoolValue -isEmpty() - +Index()
      -BoolValue -isNotEmpty() +Index(IntNumber value)
      - -push(object) - -
      - - -peek() - +Length()
      - - -pop() - -
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + @@ -2143,20 +2023,20 @@

      Method Summary


      - +
      -system'
      -

      Stack<T1>

      +system'collections'
      +

      Stack



      -public template Stack<T1>
      +public class Stack
      +ArrayList @@ -2215,19 +2095,38 @@

      Constructor / Static Method Summary

      +Stack +
      Modifier and TypeMethod
      -clear() +appendIndex(IntNumber index)
      -List<T1> -_array +_list
      -Stack<T1> constructor()
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + +get  IntNumber
      Modifier and TypeProperty
      + +get internal  IntNumber +TopPointer() +
      -Stack<T1> -allocate(IntNumber capacity) - +Length()
      @@ -2236,18 +2135,18 @@

      Constructor / Static Method Summary

      • -

        Property Summary

        +

        Conversion Summary

        - + +ArrayList
        Modifier and TypePropertyConversion Method
        -get  IntNumber -Length() +cast()
        @@ -2265,7 +2164,7 @@

        Method Summary

        -Enumerator<T1> +Enumerator enumerator() @@ -2294,14 +2193,14 @@

        Method Summary

        -push(T1 o) +push(object) -T1 + peek() @@ -2310,7 +2209,7 @@

        Method Summary

        -T1 + pop() @@ -2480,964 +2379,6 @@

        Method Summary


    - - - -
    -
    -system'
    -

    Tuple<T1>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -Tuple<T1> -constructor() - -
      - -Tuple<T1> -constructor(T1 o1) - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    Tuple<T1,T2>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1,T2>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -Tuple<T1,T2> -constructor() - -
      - -Tuple<T1,T2> -constructor(T1 o1, T2 o2) - -
      -
    • -
    - - - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    Tuple<T1,T2,T3>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1,T2,T3>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      - -T3 -Item3 -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -Tuple<T1,T2,T3> -constructor() - -
      - -Tuple<T1,T2,T3> -constructor(T1 o1, T2 o2, T3 o3) - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    Tuple<T1,T2,T3,T4>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1,T2,T3,T4>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      - -T3 -Item3 -
      - -T4 -Item4 -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -Tuple<T1,T2,T3,T4> -constructor() - -
      - -Tuple<T1,T2,T3,T4> -constructor(T1 o1, T2 o2, T3 o3, T4 o4) - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    Tuple<T1,T2,T3,T4,T5>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1,T2,T3,T4,T5>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      - -T3 -Item3 -
      - -T4 -Item4 -
      - -T5 -Item5 -
      -
    • -
    - - - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    Tuple<T1,T2,T3,T4,T5,T6>

    -
    -
    -
    -
    -
    -
    -public template Tuple<T1,T2,T3,T4,T5,T6>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      - -T3 -Item3 -
      - -T4 -Item4 -
      - -T5 -Item5 -
      - -T6 -Item6 -
      -
    • -
    - - - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      - -Indexer -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    VarTuple<T1,T2>

    -
    -
    -
    -
    -
    -
    -public template VarTuple<T1,T2>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -T1 -Item1 -
      - -T2 -Item2 -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -VarTuple<T1,T2> -constructor() - -
      - -VarTuple<T1,T2> -constructor(T1 o1, T2 o2) - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -at(IntNumber index) - -
      - - -setAt(IntNumber index, Object val) - -
      -
    • -
    -
    -
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-culture-summary.html b/doc/api/system-culture-summary.html index 145dfc2622..822d0e203d 100644 --- a/doc/api/system-culture-summary.html +++ b/doc/api/system-culture-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'culture +ELENA Standard Library 6.4: Module system'culture @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -107,7 +107,8 @@

    -public class WideString
    +public class WideString
    +A UTF-16 literal value @@ -125,7 +126,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-culture.html b/doc/api/system-culture.html index 04c694dfbc..125d8ef764 100644 --- a/doc/api/system-culture.html +++ b/doc/api/system-culture.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'culture +ELENA Standard Library 6.4: Module system'culture @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -337,7 +337,8 @@

    WideString



    -public class WideString
    +public class WideString
    +A UTF-16 literal value
    @@ -401,7 +402,7 @@

    Extension Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-drawing-summary.html b/doc/api/system-drawing-summary.html index a6cd4d184a..8fcc1e41ce 100644 --- a/doc/api/system-drawing-summary.html +++ b/doc/api/system-drawing-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'drawing +ELENA Standard Library 6.4: Module system'drawing diff --git a/doc/api/system-drawing.html b/doc/api/system-drawing.html index fd32f818a3..c3e82f1e8c 100644 --- a/doc/api/system-drawing.html +++ b/doc/api/system-drawing.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'drawing +ELENA Standard Library 6.4: Module system'drawing diff --git a/doc/api/system-dynamic-expressions-summary.html b/doc/api/system-dynamic-expressions-summary.html index 93460e0d57..b3828caef4 100644 --- a/doc/api/system-dynamic-expressions-summary.html +++ b/doc/api/system-dynamic-expressions-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'dynamic'expressions +ELENA Standard Library 6.4: Module system'dynamic'expressions diff --git a/doc/api/system-dynamic-expressions.html b/doc/api/system-dynamic-expressions.html index 54317560d7..0dbe7ac9eb 100644 --- a/doc/api/system-dynamic-expressions.html +++ b/doc/api/system-dynamic-expressions.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'dynamic'expressions +ELENA Standard Library 6.4: Module system'dynamic'expressions @@ -4092,15 +4092,6 @@

    Property Summary

    Value() - - - -set   - -Length(ref IntNumber arg1) - - - diff --git a/doc/api/system-dynamic-summary.html b/doc/api/system-dynamic-summary.html index 5ff8d653b6..bf62e432e0 100644 --- a/doc/api/system-dynamic-summary.html +++ b/doc/api/system-dynamic-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'dynamic +ELENA Standard Library 6.4: Module system'dynamic diff --git a/doc/api/system-dynamic.html b/doc/api/system-dynamic.html index bc471f14b6..504026ea62 100644 --- a/doc/api/system-dynamic.html +++ b/doc/api/system-dynamic.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'dynamic +ELENA Standard Library 6.4: Module system'dynamic diff --git a/doc/api/system-io-summary.html b/doc/api/system-io-summary.html index 9e83ae56eb..ca42c10ac1 100644 --- a/doc/api/system-io-summary.html +++ b/doc/api/system-io-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'io +ELENA Standard Library 6.4: Module system'io @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -44,6 +44,42 @@

    +BaseTextReader + + +
    +abstract public class BaseTextReader
    + + + + +BaseTextWriter + + +
    +abstract public class BaseTextWriter
    + + + + +BinaryReader + + +
    +abstract public class BinaryReader
    + + + + +BinaryStreamReader + + +
    +public class BinaryStreamReader
    + + + + BinaryStreamWriter @@ -125,6 +161,24 @@

    +MemoryBuffer + + +
    +public class MemoryBuffer
    + + + + +MemoryStream + + +
    +public class MemoryStream
    + + + + SearchDirectories @@ -230,7 +284,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-io.html b/doc/api/system-io.html index dc599516f2..0f8bf95600 100644 --- a/doc/api/system-io.html +++ b/doc/api/system-io.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'io +ELENA Standard Library 6.4: Module system'io @@ -19,24 +19,24 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    - +
    system'io'
    -

    BinaryStreamWriter

    +

    BaseTextReader



    -public class BinaryStreamWriter
    +abstract public class BaseTextReader
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + +String + + + + @@ -98,20 +123,20 @@

      Constructor / Static Method Summary


      - +
      system'io'
      -

      BinaryWriter

      +

      BaseTextWriter



      -abstract public class BinaryWriter
      +abstract public class BaseTextWriter
        @@ -120,7 +145,13 @@

        BinaryWriter

      @@ -136,14 +167,106 @@

      Field Summary

      +TextBuilder + + + + + + + + + +
      Modifier and TypeConstructor / Static MethodMethod
      -BinaryStreamWriter -constructor(Stream stream) +readLine() + +
      + +WideString +readWideLine()
      -Stream -_stream +_buffer +
      + +String +_newLineConstant +
      + +IntNumber +_newLineLength +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeMethod
      + + +write(String line) + +
      + + +write(WideString line) + +
      + + +writeLine(line) + +
      + + +writeLine() +
    +
    +
    + + + +
    +
    +system'io'
    +

    BinaryReader

    +
    +
    +
    +
    +
    +
    +abstract public class BinaryReader
    +
    +
    +
    - +
    system'io'
    -

    ConsoleReader

    +

    BinaryStreamReader



    -public class ConsoleReader
    +public class BinaryStreamReader

    - +
    system'io'
    -

    ConsoleWriter

    +

    BinaryStreamWriter



    -public class ConsoleWriter
    +public class BinaryStreamWriter
    + +
      +
    • +

      Property Summary

      + + + + + + + + + +
      Modifier and TypeProperty
      + +get  Object +Source() +
      +
    • +
    +
    +
    + + + +
    +
    +system'io'
    +

    BinaryWriter

    +
    +
    +
    +
    +
    +
    +abstract public class BinaryWriter
    +
    +
    + + +
      +
    • +

      Property Summary

      + + + + + + + + +
      Modifier and TypeProperty
      + +get abstract  Object -clear() +Source() +
      +
    • +
    + +
    +
    +
    + + + +
    +
    +system'io'
    +

    ConsoleWriter

    +
    +
    +
    +
    +
    +
    +public class ConsoleWriter
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + +Handle +h +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + - +
      Modifier and TypeConstructor / Static Method
      + +ConsoleWriter +constructor(Handle h)
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeMethod
      + + +write(WideString s) + +
      + + +write(String s) + +
      + + +clear() + +
      + + +setCursorPosition(IntNumber x, IntNumber y) + +
      + + +refresh() + +
      +
    • +
    +
    +
    + + + +
    +
    +system'io'
    +

    Directory

    +
    +
    +
    +
    +
    +
    +public class Directory
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + +String +_path +
      +
    • +
    + + + +
      +
    • +

      Property Summary

      + + + + + + + + + +
      Modifier and TypeProperty
      + +get  BoolValue +Available() +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeMethod
      + +system'String[] +getFiles() + +
      + +system'String[] +getFiles(String mask) + +
      + + +create() + +
      + + +delete() + +
      +
    • +
    +
    +
    + + + +
    +
    +system'io'
    +

    File

    +
    +
    +
    +
    +
    +
    +public class File
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + +String +_path +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + + +saveContent(String path, String content) + +
      + + +readContentTo(String path, TextBuilder output) + +
      + +String +readContent(String path) + +
      + +WideString +readWideContent(String path) + +
      + +File +assign(String path) + +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  BoolValue +Available() +
      + +get  IntNumber +Length() +
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + + + + + + + + + +
      Modifier and TypeConversion Method
      + +String +cast() +
      + +WideString +cast() +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeMethod
      + +TextReader +textreader() + +
      + +TextWriter +textwriter() + +
      + +TextWriter +logger() + +
      + + +saveContent(String content) + +
      + +String +readContent() + +
      + +WideString +readWideContent() + +
      + + +delete() + +
      +
    • +
    +
    +
    + + + +
    +
    +system'io'
    +

    FileEnumerator

    +
    +
    +
    +
    +
    +
    +public class FileEnumerator
    +
    +
    + + + + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +FileEnumerator +assign(String mask) + +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + +
      Modifier and TypeProperty
      + +get  WIN32_FIND_DATA +Value() +
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + + + + + +
      Modifier and TypeConversion Method
      + +Enumerator +cast() +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + +BoolValue - + - + @@ -644,20 +1624,20 @@

      Method Summary


      - +
      system'io'
      -

      File

      +

      FileStream



      -public class File
      +public class FileStream
        @@ -666,7 +1646,13 @@

        File

      @@ -682,9 +1668,9 @@

      Field Summary

      +Handle
      Modifier and TypeMethod
      -system'String[] -getFiles(String mask) +next()
      -create() +reset()
      -delete() +enumerable()
      -String -_path +_handle
      @@ -702,9 +1688,45 @@

      Constructor / Static Method Summary

      -File +FileStream
      -assign(String path) +openForRead(path) + + + + + + +FileStream + +openForReWrite(path) + + + + + + +FileStream + +openForAppend(path) + + + + + + +FileStream + +openForEdit(path) + + + + + + +FileStream + +new(WideString path, IntNumber dwDesiredAccess, IntNumber dwShareMode, IntNumber dwCreationDisposition, IntNumber dwFlagsAndAttributes) @@ -723,45 +1745,35 @@

      Property Summary

      -get  BoolValue +get  IntNumber
      -Available() +Length() -get  IntNumber +set  
      -Length() +Length(IntNumber length) + - -
    • -
    - - +
    +
    + + + +
    +
    +system'io'
    +

    IOException

    +
    +
    +
    +
    +
    +
    +public class IOException
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + +String - + +CallStack - +
      Modifier and TypeField
      - -saveContent(String content) - +message
      -String -readContent() - +callStack
      +
    • +
    + +
    - -
    - +
    system'io'
    -

    FileStream

    +

    MemoryStream



    -public class FileStream
    +public class MemoryStream
      @@ -1042,7 +2117,7 @@

      FileStream

      • -system'io'FileStream
      • +system'io'MemoryStream
    @@ -1060,9 +2135,17 @@

    Field Summary

    -Handle +MemoryBuffer
    -_handle +_buffer + + + + + +Reference<system'IntNumber> + +_position @@ -1080,45 +2163,27 @@

    Constructor / Static Method Summary

    -FileStream - -openForRead(path) - - - - - - -FileStream - -openForReWrite(path) - - - - - - -FileStream +MemoryStream
    -openForAppend(path) +constructor() -FileStream +MemoryStream -openForEdit(path) +constructor(MemoryBuffer buffer) -FileStream +MemoryStream -new(WideString path, IntNumber dwDesiredAccess, IntNumber dwShareMode, IntNumber dwCreationDisposition, IntNumber dwFlagsAndAttributes) +load(IntNumber index, IntNumber length, system'ByteNumber[] array) @@ -1183,9 +2248,9 @@

    Method Summary

    - +IntNumber
    -read(system'ByteNumber[] dump, ref IntNumber retVal) +read(system'ByteNumber[] dump, IntNumber len) @@ -1212,98 +2277,6 @@

    Method Summary


    - - - -
    -
    -system'io'
    -

    IOException

    -
    -
    -
    -
    -
    -
    -public class IOException
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -String -message -
      - -CallStack -callStack -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -IOException -new() - -
      - -IOException -new(String message) - -
      -
    • -
    -
    -
    @@ -1504,9 +2477,9 @@

    Method Summary

    -abstract   +abstract  IntNumber
    -read(system'ByteNumber[] dump, ref IntNumber length) +read(system'ByteNumber[] dump, IntNumber length) @@ -1559,12 +2532,18 @@

    StreamWriter

  • + +
    @@ -1677,9 +2647,9 @@

    Property Summary

    -get  Stream +get  Object
    -Stream() +Source() @@ -1751,42 +2721,6 @@

    TextReader

    - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -TextBuilder -_output -
      - -String -_newLineConstant -
      - -IntNumber -_newLineLength -
      -
    • -
    + + - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeField
      - -TextBuilder -_buffer -
      - -String -_newLineConstant -
      - -IntNumber -_newLineLength -
      -
    • -
    • @@ -2146,9 +3050,9 @@

      Property Summary

      -get abstract  Stream +get abstract  Object
      -Stream() +Source() @@ -2201,34 +3105,34 @@

      Method Summary

      - +abstract   -writeLine(line) +write(String line) - +abstract   -write(String line) +write(WideString line) - +abstract   -write(WideString line) +writeLine(line) - +abstract   writeLine() @@ -2324,7 +3228,7 @@

      Symbol Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-math-summary.html b/doc/api/system-math-summary.html index 9008b2c20e..bf88cc3b18 100644 --- a/doc/api/system-math-summary.html +++ b/doc/api/system-math-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'math +ELENA Standard Library 6.4: Module system'math @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -47,6 +47,35 @@

  • +Symbol Summary +
    + + + + + + + + + + + + +
    Symbol nameDescription
    +E + +
    +E
    +
    +Pi + +
    +Pi
    +
    +
  • +
  • + +
    Extended Class Summary
    @@ -78,7 +107,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-math.html b/doc/api/system-math.html index 82b8b6ddce..e089740a2b 100644 --- a/doc/api/system-math.html +++ b/doc/api/system-math.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'math +ELENA Standard Library 6.4: Module system'math @@ -19,10 +19,84 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    + + + +
    +
    +system'math'
    +

    E

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      +

    + + + + + + +
    Modifier and TypeName
    + +public  RealNumber +E +
    +
  • + + +
    + + + + +
    +
    +system'math'
    +

    Pi

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public  RealNumber +Pi +
      +
    • +
    +
    +
    +
    @@ -196,7 +270,7 @@

    Extension Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-net-summary.html b/doc/api/system-net-summary.html index d11eb00156..c975134c10 100644 --- a/doc/api/system-net-summary.html +++ b/doc/api/system-net-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'net +ELENA Standard Library 6.4: Module system'net diff --git a/doc/api/system-net.html b/doc/api/system-net.html index 8e016f89be..abfbd8a421 100644 --- a/doc/api/system-net.html +++ b/doc/api/system-net.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'net +ELENA Standard Library 6.4: Module system'net diff --git a/doc/api/system-routines-summary.html b/doc/api/system-routines-summary.html index d22bc33f93..1559305284 100644 --- a/doc/api/system-routines-summary.html +++ b/doc/api/system-routines-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'routines +ELENA Standard Library 6.4: Module system'routines diff --git a/doc/api/system-routines.html b/doc/api/system-routines.html index 3475ccc4ae..b9ea0f158e 100644 --- a/doc/api/system-routines.html +++ b/doc/api/system-routines.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'routines +ELENA Standard Library 6.4: Module system'routines diff --git a/doc/api/system-runtime-summary.html b/doc/api/system-runtime-summary.html index 1369066975..8b7f83724c 100644 --- a/doc/api/system-runtime-summary.html +++ b/doc/api/system-runtime-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'runtime +ELENA Standard Library 6.4: Module system'runtime diff --git a/doc/api/system-runtime.html b/doc/api/system-runtime.html index 94bc35db11..bf9f4aacd2 100644 --- a/doc/api/system-runtime.html +++ b/doc/api/system-runtime.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'runtime +ELENA Standard Library 6.4: Module system'runtime diff --git a/doc/api/system-summary.html b/doc/api/system-summary.html index 2b99cc4e3f..3df7b5917c 100644 --- a/doc/api/system-summary.html +++ b/doc/api/system-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system +ELENA Standard Library 6.4: Module system @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -54,6 +54,60 @@

    +Action<T1> + + +
    +abstract public template Action<T1>
    + + + + +Action<T1,T1> + + +
    +abstract public template Action<T1,T1>
    + + + + +Action<T1,T2> + + +
    +abstract public template Action<T1,T2>
    + + + + +Action<T1,T2,T3> + + +
    +abstract public template Action<T1,T2,T3>
    + + + + +Action<T1,T2,T3,T4> + + +
    +abstract public template Action<T1,T2,T3,T4>
    + + + + +Action<T1,T2,T3,T4,T5> + + +
    +abstract public template Action<T1,T2,T3,T4,T5>
    + + + + Array @@ -90,6 +144,15 @@

    +BaseEnumerator + + +
    +abstract public class BaseEnumerator
    + + + + BaseEnumerator<T1> @@ -97,7 +160,7 @@

    abstract public template BaseEnumerator<T1> - + BaseExtender @@ -106,7 +169,7 @@

    public class BaseExtender - + BaseIndexer @@ -115,7 +178,7 @@

    abstract public class BaseIndexer - + BaseIndexer<T1> @@ -124,7 +187,7 @@

    abstract public template BaseIndexer<T1> - + BaseLazyExpression @@ -133,7 +196,7 @@

    abstract public class BaseLazyExpression - + BaseNumber @@ -143,7 +206,7 @@

    a base numeric value - + BaseValue @@ -153,7 +216,7 @@

    a base value - + BaseVariable @@ -163,7 +226,7 @@

    variable base class - + BitArray @@ -172,7 +235,7 @@

    public class BitArray - + BitArray32 @@ -181,7 +244,7 @@

    public class BitArray32 - + BoolValue @@ -191,7 +254,7 @@

    a common boolean value - + BoolValue#false @@ -200,7 +263,7 @@

    public singleton BoolValue#false - + BoolValue#true @@ -209,7 +272,7 @@

    public singleton BoolValue#true - + byteArrayConvertor @@ -218,7 +281,7 @@

    public singleton byteArrayConvertor - + byteConvertor @@ -227,7 +290,7 @@

    public singleton byteConvertor - + ByteNumber @@ -237,7 +300,7 @@

    an unsigned 8 bit integer - + CallStack @@ -247,7 +310,7 @@

    A call stack - + charConvertor @@ -256,7 +319,7 @@

    public singleton charConvertor - + CharValue @@ -266,7 +329,7 @@

    An UTF-32 character symbol - + ClassReference @@ -275,13 +338,22 @@

    public class ClassReference - + Console
    -public class Console
    +public singleton Console + + + + +ConsoleHelperImpl + + +
    +public class ConsoleHelperImpl
    @@ -354,7 +426,8 @@

    -public class Exception
    +public class Exception
    +A basic exception @@ -406,6 +479,15 @@

    +Func<T1,T1,system'IntNumber> + + +
    +abstract public template Func<T1,T1,system'IntNumber>
    + + + + Func<T1,T2> @@ -413,7 +495,7 @@

    abstract public template Func<T1,T2> - + Func<T1,T2,T3> @@ -422,7 +504,7 @@

    abstract public template Func<T1,T2,T3> - + Func<T1,T2,T3,T4> @@ -431,7 +513,7 @@

    abstract public template Func<T1,T2,T3,T4> - + Func<T1,T2,T3,T4,T5> @@ -440,7 +522,7 @@

    abstract public template Func<T1,T2,T3,T4,T5> - + Func<T1,T2,T3,T4,T5,T6> @@ -449,7 +531,7 @@

    abstract public template Func<T1,T2,T3,T4,T5,T6> - + Func1 @@ -458,7 +540,7 @@

    abstract public class Func1 - + Func10 @@ -467,7 +549,7 @@

    abstract public class Func10 - + Func11 @@ -476,7 +558,7 @@

    abstract public class Func11 - + Func2 @@ -485,7 +567,7 @@

    abstract public class Func2 - + Func3 @@ -494,7 +576,7 @@

    abstract public class Func3 - + Func4 @@ -503,7 +585,7 @@

    abstract public class Func4 - + Func5 @@ -512,7 +594,7 @@

    abstract public class Func5 - + Func6 @@ -521,7 +603,7 @@

    abstract public class Func6 - + Func7 @@ -530,7 +612,7 @@

    abstract public class Func7 - + Func8 @@ -539,7 +621,7 @@

    abstract public class Func8 - + Func9 @@ -548,7 +630,7 @@

    abstract public class Func9 - + Handle @@ -557,7 +639,7 @@

    public class Handle - + IConsoleReader @@ -566,7 +648,7 @@

    abstract public class IConsoleReader - + IConsoleWriter @@ -575,7 +657,7 @@

    abstract public class IConsoleWriter - + Indexable @@ -584,7 +666,7 @@

    abstract public class Indexable - + Indexable<T1> @@ -593,7 +675,7 @@

    abstract public template Indexable<T1> - + Indexer @@ -602,7 +684,7 @@

    abstract public class Indexer - + Indexer<T1> @@ -611,7 +693,7 @@

    abstract public template Indexer<T1> - + IntBaseNumber @@ -621,7 +703,7 @@

    a base integer value - + intConvertor @@ -630,7 +712,7 @@

    public singleton intConvertor - + IntMatrix @@ -639,7 +721,7 @@

    public class IntMatrix - + IntNumber @@ -649,7 +731,7 @@

    A signed 32 bit integer - + InvalidArgumentException @@ -658,7 +740,7 @@

    public class InvalidArgumentException - + InvalidOperationException @@ -667,7 +749,7 @@

    public class InvalidOperationException - + KeyValue @@ -677,7 +759,7 @@

    A key - object pair
    Extends the object with a key property
    - + longConvertor @@ -686,7 +768,7 @@

    public singleton longConvertor - + LongNumber @@ -696,16 +778,17 @@

    A signed 64 bit integer value - + Message
    -public class Message
    +public class Message
    +A message constant - + MessageName @@ -714,7 +797,7 @@

    public class MessageName - + MethodNotFoundException @@ -723,7 +806,7 @@

    public class MethodNotFoundException - + mssgConvertor @@ -732,7 +815,7 @@

    public singleton mssgConvertor - + NilReferenceException @@ -741,7 +824,7 @@

    public class NilReferenceException - + nilValue @@ -751,7 +834,7 @@

    A nil value - + NotSupportedException @@ -760,7 +843,7 @@

    public class NotSupportedException - + Object @@ -770,7 +853,7 @@

    a common ancestor - + OutOfMemoryException @@ -779,7 +862,7 @@

    public class OutOfMemoryException - + OutOfRangeException @@ -788,7 +871,7 @@

    public class OutOfRangeException - + Range @@ -797,7 +880,7 @@

    public class Range - + realConvertor @@ -806,7 +889,7 @@

    public singleton realConvertor - + RealMatrix @@ -815,7 +898,7 @@

    public class RealMatrix - + RealNumber @@ -825,7 +908,7 @@

    A 64bit float numeric value - + Reference<T1> @@ -834,7 +917,7 @@

    public template Reference<T1> - + sbyteConvertor @@ -843,7 +926,7 @@

    public singleton sbyteConvertor - + SByteNumber @@ -853,7 +936,7 @@

    a signed 8 bit integer - + shortArrayConvertor @@ -862,7 +945,7 @@

    public singleton shortArrayConvertor - + shortConvertor @@ -871,7 +954,7 @@

    public singleton shortConvertor - + ShortNumber @@ -881,7 +964,7 @@

    a signed 16 bit integer - + SMALL_RECT @@ -890,7 +973,7 @@

    public class SMALL_RECT - + StackOverflowException @@ -899,6 +982,15 @@

    public class StackOverflowException + + +StartUpEvents + + +
    +public class StartUpEvents
    + + String @@ -1027,7 +1119,8 @@

    -public class WideString
    +public class WideString
    +A UTF-16 literal value @@ -1043,11 +1136,11 @@

    -commandLine +CommandLine
    -commandLine
    +CommandLine @@ -1070,6 +1163,15 @@

    +EmptyString + + +
    +EmptyString
    + + + + emptyString @@ -1077,7 +1179,7 @@

    emptyString - + emptyWideString @@ -1086,7 +1188,7 @@

    emptyWideString - + false @@ -1095,16 +1197,16 @@

    false - + -newLineConstant +NewLineConstant
    -newLineConstant
    +NewLineConstant - + Pi_value @@ -1113,6 +1215,15 @@

    Pi_value + + +startUpEvents + + +
    +startUpEvents
    + + true @@ -1137,7 +1248,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-text-summary.html b/doc/api/system-text-summary.html index 3de4a3e16b..c50ebfefe8 100644 --- a/doc/api/system-text-summary.html +++ b/doc/api/system-text-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'text +ELENA Standard Library 6.4: Module system'text @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -53,6 +53,15 @@

    +StringBuilder + + +
    +public class StringBuilder
    + + + + TextBuilder @@ -60,7 +69,7 @@

    public class TextBuilder - + UTF16Encoder @@ -69,7 +78,7 @@

    public singleton UTF16Encoder - + UTF16Encoding @@ -78,7 +87,7 @@

    public singleton UTF16Encoding - + UTF8Encoder @@ -87,7 +96,7 @@

    public singleton UTF8Encoder - + UTF8Encoding @@ -96,6 +105,15 @@

    public singleton UTF8Encoding + + +WideStringBuilder + + +
    +public class WideStringBuilder
    + + WinEncoder @@ -158,7 +176,7 @@

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-text.html b/doc/api/system-text.html index 0f188f1373..8106dcd7cf 100644 --- a/doc/api/system-text.html +++ b/doc/api/system-text.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system'text +ELENA Standard Library 6.4: Module system'text @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -61,9 +61,9 @@

    Method Summary

    -abstract   +abstract  IntNumber
    -convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index, ref IntNumber length) +convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index) @@ -79,27 +79,27 @@

    Method Summary

    - +IntNumber
    -convertFrom(system'ByteNumber[] byteArray, IntNumber index, ref IntNumber len, system'CharValue[] output, IntNumber outputIndex, ref IntNumber outputLen) +convertFrom(system'ByteNumber[] byteArray, IntNumber index, ref IntNumber len, system'CharValue[] output, IntNumber outputIndex, IntNumber outputLen) - +IntNumber -convertTo(system'CharValue[] chars, IntNumber index, ref IntNumber len, system'ByteNumber[] output, IntNumber outputIndex, ref IntNumber outputLen) +convertTo(system'CharValue[] chars, IntNumber index, ref IntNumber len, system'ByteNumber[] output, IntNumber outputIndex, IntNumber outputLen) - +IntNumber -toByteArray(String s, IntNumber index, ref IntNumber length, system'ByteNumber[] output, IntNumber outputIndex, ref IntNumber outputLength) +toByteArray(String s, IntNumber index, ref IntNumber length, system'ByteNumber[] output, IntNumber outputIndex, IntNumber outputLength) @@ -126,6 +126,186 @@

    Method Summary


    + + + +
    +
    +system'text'
    +

    StringBuilder

    +
    +
    +
    +
    +
    +
    +public class StringBuilder
    +
    +
    + + + + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +StringBuilder +constructor() + +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  IntNumber +Length() +
      + +get  String +Value() +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeMethod
      + + +insert(index, o) + +
      + + +write(CharValue ch) + +
      + + +write(String s) + +
      + + +wide(o) + +
      + + +insert(IntNumber index, CharValue ch) + +
      + + +insert(IntNumber index, String s) + +
      + + +delete(IntNumber index, IntNumber length) + +
      +
    • +
    +
    +
    @@ -575,9 +755,9 @@

    Method Summary

    - +IntNumber
    -convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index, ref IntNumber length) +convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index) @@ -586,7 +766,7 @@

    Method Summary

    CharValue -convertToChar(system'ByteNumber[] byteArray, IntNumber index, ref IntNumber length) +convertToChar(system'ByteNumber[] byteArray, IntNumber index, ref IntNumber chLen) @@ -669,6 +849,15 @@

    Method Summary

    + + +toShortArray(CharValue ch, system'ShortNumber[] output, IntNumber outputIndex, ref IntNumber len) + + + + + + IntNumber getCharCount(WideString s) @@ -724,9 +913,9 @@

    Method Summary

    - +IntNumber
    -convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index, ref IntNumber length) +convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index) @@ -811,6 +1000,186 @@

    Method Summary


    + + + +
    +
    +system'text'
    +

    WideStringBuilder

    +
    +
    +
    +
    +
    +
    +public class WideStringBuilder
    +
    +
    + + + + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +WideStringBuilder +constructor() + +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  IntNumber +Length() +
      + +get  String +Value() +
      +
    • +
    + + +
    +
    @@ -896,9 +1265,9 @@

    Method Summary

    - +IntNumber
    -convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index, ref IntNumber length) +convertChar(CharValue ch, system'ByteNumber[] byteArray, IntNumber index) @@ -1038,7 +1407,7 @@

    Symbol Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/api/system-threading-summary.html b/doc/api/system-threading-summary.html index ef9a4ae5bf..78f8c2c99f 100644 --- a/doc/api/system-threading-summary.html +++ b/doc/api/system-threading-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'threading +ELENA Standard Library 6.4: Module system'threading @@ -44,15 +44,6 @@

    -Array<T1> - - -
    -public template Array<T1>
    - - - - AsyncStateEnumerator @@ -60,7 +51,7 @@

    abstract public class AsyncStateEnumerator - + AutoResetEvent @@ -69,15 +60,6 @@

    public class AutoResetEvent - - -BaseEnumerator<T1> - - -
    -abstract public template BaseEnumerator<T1>
    - - BaseEvent @@ -89,15 +71,6 @@

    -BaseIndexer<T1> - - -
    -abstract public template BaseIndexer<T1>
    - - - - BlockingQueue<T1> @@ -105,15 +78,6 @@

    public template BlockingQueue<T1> - - -ConcurrentQueue<T1> - - -
    -public template ConcurrentQueue<T1>
    - - CountDownEvent @@ -125,51 +89,6 @@

    -Enumerable<T1> - - -
    -abstract public template Enumerable<T1>
    - - - - -Enumerator<T1> - - -
    -abstract public template Enumerator<T1>
    - - - - -Indexable<T1> - - -
    -abstract public template Indexable<T1>
    - - - - -Indexer<T1> - - -
    -abstract public template Indexer<T1>
    - - - - -List<T1> - - -
    -public template List<T1>
    - - - - ManualResetEvent @@ -177,40 +96,31 @@

    public class ManualResetEvent - - -Queue<T1> - - -
    -public template Queue<T1>
    - - -Reference<T1> +Semaphore
    -public template Reference<T1>
    +public class Semaphore -Semaphore +Task
    -public class Semaphore
    +public class Task -Task +Task<T1>
    -public class Task
    +public template Task<T1> @@ -316,6 +226,15 @@

    +ThreadPool#initializer$inline0 + + +
    +ThreadPool#initializer$inline0
    + + + + WAIT_OBJECT_0 @@ -323,7 +242,7 @@

    WAIT_OBJECT_0 - + WAIT_TIMEOUT diff --git a/doc/api/system-threading.html b/doc/api/system-threading.html index 6717c818a5..04dcd08829 100644 --- a/doc/api/system-threading.html +++ b/doc/api/system-threading.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'threading +ELENA Standard Library 6.4: Module system'threading @@ -23,20 +23,20 @@ - +
    system'threading'
    -

    Array<T1>

    +

    AsyncStateEnumerator



    -public template Array<T1>
    +abstract public class AsyncStateEnumerator
    - - - +
    • -

      Static Property Summary

      +

      Constructor / Static Method Summary

      - + - - - - +Task
      Modifier and TypeStatic PropertyConstructor / Static Method
      -get  T1[] -Default() -
      - -get  T1[] -MinValue() +proceed(Enumerator<system'threading'Task> e) +
      @@ -176,9 +116,9 @@

      Property Summary

      -get  IntNumber +get  Task
      -Length() +Value() @@ -196,7 +136,7 @@

      Conversion Summary

      -Enumerable +Enumerator
      cast() @@ -216,45 +156,9 @@

      Method Summary

      -Indexer<T1> - -indexer() - - - - - - - - -at(n) - - - - - - -setAt(n, item) - - - - - - -Enumerator<T1> - -enumerator() - - - - - - -T1 - -at(IntNumber n) +reset() @@ -263,34 +167,7 @@

      Method Summary

      -setAt(IntNumber n, T1 item) - - - - - - -T1[] - -add(T1[] a) - - - - - - -T1[] - -add(T1[] a, IntNumber length) - - - - - - -T1[] - -clone() +enumerable() @@ -299,20 +176,20 @@

      Method Summary


    - +
    system'threading'
    -

    AsyncStateEnumerator

    +

    AutoResetEvent



    -abstract public class AsyncStateEnumerator
    +public class AutoResetEvent
    - +
    +
    + + + +
    +
    +system'threading'
    +

    BaseEvent

    +
    +
    +
    +
    +
    +
    +public class BaseEvent
    +
    +
    + +
    • -

      Property Summary

      +

      Field Summary

      - + +EventHandle
      Modifier and TypePropertyField
      -get  Task -Value() +_handle
    - +
    • -

      Conversion Summary

      +

      Method Summary

      - + + -
      Modifier and TypeConversion MethodMethod
      -Enumerator -cast() +wait() +
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - + + + @@ -443,7 +338,16 @@

      Method Summary

      + + + + @@ -452,20 +356,20 @@

      Method Summary


      - +
      system'threading'
      -

      AutoResetEvent

      +

      BlockingQueue<T1>



      -public class AutoResetEvent
      +public template BlockingQueue<T1>
        @@ -474,13 +378,7 @@

        AutoResetEvent

      @@ -496,186 +394,43 @@

      Field Summary

      +ConcurrentQueue<T1> - -
      Modifier and TypeMethod
      + + +wait(IntNumber timeOut) + +
      -reset() +set()
      -enumerable() +reset() + +
      + + +close()
      -EventHandle -_handle -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -AutoResetEvent -new() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    BaseEnumerator<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template BaseEnumerator<T1>
    -
    -
    - - - - -
      -
    • -

      Conversion Summary

      - - - - - - - +Semaphore
      Modifier and TypeConversion Method
      - -Enumerator -cast() +_semaphore
    - +
    • -

      Method Summary

      +

      Constructor / Static Method Summary

      - + +BlockingQueue<T1>
      Modifier and TypeMethodConstructor / Static Method
      -BoolValue -next() +constructor()
    -
    -
    - - - -
    -
    -system'threading'
    -

    BaseEvent

    -
    -
    -
    -
    -
    -
    -public class BaseEvent
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - -
      Modifier and TypeField
      - -EventHandle -_handle -
      -
    • -
    • @@ -690,43 +445,16 @@

      Method Summary

      -wait() - - - - - - - - -wait(IntNumber timeOut) - - - - - - - - -set() +push(T1 value) - - -reset() - - - - - - - +T1 -close() +pop() @@ -735,20 +463,20 @@

      Method Summary


    - +
    system'threading'
    -

    BaseIndexer<T1>

    +

    CountDownEvent



    -abstract public template BaseIndexer<T1>
    +public class CountDownEvent
      @@ -757,1029 +485,54 @@

      BaseIndexer<T1>

    • -
    • -
    - - - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get  BoolValue -Available() -
      - -get  IntNumber -Index() -
      - -set   -Index(IntNumber index) - -
      - -get  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -Indexer -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - - -appendIndex(IntNumber offs) - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    BlockingQueue<T1>

    -
    -
    -
    -
    -
    -
    -public template BlockingQueue<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'threading'BlockingQueue<T1>
      • -
      -
    • -
    - - - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -BlockingQueue<T1> -constructor() - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -push(T1 value) - -
      - -T1 -pop() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    ConcurrentQueue<T1>

    -
    -
    -
    -
    -
    -
    -public template ConcurrentQueue<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'threading'ConcurrentQueue<T1>
      • -
      -
    • -
    - - - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -ConcurrentQueue<T1> -constructor() - -
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get  IntNumber -Length() -
      - -get  Queue<T1> -Snapshot() -
      -Returns a copy of the queue
      -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -push(T1 object) - -
      - -T1 -pop() - -
      - - -clear() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    CountDownEvent

    -
    -
    -
    -
    -
    -
    -public class CountDownEvent
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -EventHandle -_handle -
      - -IntNumber -_counter -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -CountDownEvent -new(IntNumber counter) - -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - - -wait() - -
      - - -wait(IntNumber timeOut) - -
      - - -signal() - -
      - - -close() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    Enumerable<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Enumerable<T1>
    -
    -
    - - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  Enumerator<T1> -enumerator() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    Enumerator<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Enumerator<T1>
    -
    -
    - - -
      -
    • -

      Property Summary

      - - - - - - - - - -
      Modifier and TypeProperty
      - -get abstract  T1 -Value() -
      -Returns the current object
      -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -abstract  Enumerator -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  BoolValue -next() - -
      - -abstract   -reset() - -
      - -abstract   -enumerable() - -
      - -Enumerator<T1> -enumerator() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    Indexable<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Indexable<T1>
    -
    -
    - - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract  Indexer<T1> -indexer() - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    Indexer<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Indexer<T1>
    -
    -
    - - -
      -
    • -

      Property Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Modifier and TypeProperty
      - -get abstract  BoolValue -Available() -
      - -get abstract  T1 -Value() -
      - -set abstract   -Value(T1 value) - -
      - -get abstract  IntNumber -Index() -
      - -set abstract   -Index(IntNumber value) - -
      - -get abstract  IntNumber -Length() -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - -
      Modifier and TypeConversion Method
      - -abstract  Indexer -cast() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - - - - - -
      Modifier and TypeMethod
      - -abstract   -appendIndex(IntNumber index) - -
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    List<T1>

    -
    -
    -
    -
    -
    -
    -public template List<T1>
    -
    -
    - - - - - - +
    • -

      Property Summary

      +

      Field Summary

      - + +EventHandle +IntNumber +
      Modifier and TypePropertyField
      -get  IntNumber -Length() +_handle
      -get  T1 -First() +_counter
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + +CountDownEvent
      Modifier and TypeConstructor / Static Method
      -get  T1[] -Value() +new(IntNumber counter) +
      @@ -1797,63 +550,9 @@

      Method Summary

      -Enumerator<T1> - -enumerator() - - - - - - -T1 - -at(IntNumber index) - - - - - - - - -setAt(IntNumber index, T1 object) - - - - - - - - -append(T1 object) - - - - - - - - -appendRange(Enumerator<T1> e) - - - - - - - - -insert(IntNumber index, T1 object) - - - - - - -insert(T1 object) +wait() @@ -1862,7 +561,7 @@

      Method Summary

      -remove(IntNumber index) +wait(IntNumber timeOut) @@ -1871,25 +570,7 @@

      Method Summary

      -clear() - - - - - - - - -trim(IntNumber pos) - - - - - - -Indexer<T1> - -indexer() +signal() @@ -1898,7 +579,7 @@

      Method Summary

      -clone() +close() @@ -1991,20 +672,20 @@

      Constructor / Static Method Summary


    - +
    system'threading'
    -

    Queue<T1>

    +

    Semaphore



    -public template Queue<T1>
    +public class Semaphore
      @@ -2013,13 +694,7 @@

      Queue<T1>

    @@ -2035,254 +710,243 @@

    Field Summary

    -List<T1> +Handle
    -_array +_handle - - - -Reference<system'IntNumber> - -_top - + + + + + - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + + + -
      Modifier and TypeConstructor / Static MethodMethod
      -Queue<T1> -constructor() +close()
      -Queue<T1> -allocate(IntNumber capacity) +wait()
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - +
      Modifier and TypeProperty
      -get  IntNumber -Length() +release() +
    - +
    +
    + + + +
    +
    +system'threading'
    +

    Task

    +
    +
    +
    +
    +
    +
    +public class Task
    +
    +
    + + + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + +Task +Task -
      Modifier and TypeConstructor / Static Method
      -T1 -peek() +dispatch()
      -T1 -pop() +whenAllArgs(params Task[] tasks)
      - -clear() +whenAll(system'threading'Task[] tasks)
      -
    • -
    -
    -
    - - - -
    -
    -system'threading'
    -

    Reference<T1>

    -
    -
    -
    -
    -
    -
    -public template Reference<T1>
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - + + + + -
      Modifier and TypeField
      + + +waitAll(system'threading'Task[] tasks) + +
      -T1 -value +waitAllArgs(params Task[] tasks) +
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - + + + +Task -
      Modifier and TypeConstructor / Static Method
      + +Task +run(Func action) + +
      -Reference<T1> -constructor(T1 val) +sleep(IntNumber msecs) -
      -Initializes a variable
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - + + + +internal  Task +Task
      Modifier and TypeProperty
      + +Task +constructor2() + +
      -get  T1 -Value() -
      -Returns the variable value
      +newPromise() +
      -set   -Value(T1 val) +assign(Func action) -
      -Set the variable value
      @@ -2291,20 +955,18 @@

      Property Summary

      • -

        Conversion Summary

        +

        Property Summary

        - + +get  
        Modifier and TypeConversion MethodProperty
        -T1 -cast() -
        -Returns the variable value
        +Result()
        @@ -2322,23 +984,19 @@

        Method Summary

        -BoolValue +internal private  
        -equal(o) +getResultUnsafe() -
        -Returns true if o is equal to the variable value; otherwise, false
        -String +internal private  Exception
        -toPrintable() +Exception() -
        -Returns the value string representation
        @@ -2346,97 +1004,25 @@

        Method Summary

        -dispatch() +continueWith(Action<system'threading'Task> action) - -
      • -
      -
      -
    - - - -
    -
    -system'threading'
    -

    Semaphore

    -
    -
    -
    -
    -
    -
    -public class Semaphore
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - - - - -
      Modifier and TypeField
      - -Handle -_handle -
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - + +internal   -
      Modifier and TypeConstructor / Static Method
      -Semaphore -create(IntNumber initValue, IntNumber maxValue) +setResult()
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - +internal   @@ -2454,7 +1040,7 @@

      Method Summary

      @@ -2463,20 +1049,20 @@

      Method Summary


      - +
      system'threading'
      -

      Task

      +

      Task<T1>



      -public class Task
      +public template Task<T1>
        @@ -2485,7 +1071,13 @@

        Task

      @@ -2522,6 +1114,22 @@

      Field Summary

      _continuation +
      + + + + + + +
      Modifier and TypeMethod
      - -close() +setException(Exception ex)
      -release() +start()
      + +Func +_action +
      + +T1 +_result +
    @@ -2537,54 +1145,45 @@

    Constructor / Static Method Summary

    - +Task<T1>
    -dispatch() +run(Func<T1> action) -Task +Task<T1> -whenAllArgs(params Task[] tasks) +constructor2() -Task +Task<T1> -whenAll(system'threading'Task[] tasks) +constructor(T1 retVal) - +internal  Task<T1> -waitAll(system'threading'Task[] tasks) +newPromise() -Task - -Run(Func action) - - - - - - -internal  Task +Task<T1> -constructor() +assign(Func<T1> func) @@ -2603,56 +1202,58 @@

    Property Summary

    -get internal  Exception +get  T1
    -Exception() +Result() - +
    • -

      Method Summary

      +

      Conversion Summary

      - + +T1 - - - +
      Modifier and TypeMethodConversion Method
      - -continueWith(Action<system'threading'Task> action) - +cast()
      - - -setResult() - -
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + +internal private  T1 +internal private   @@ -3453,6 +2054,43 @@

      Symbol Summary


      + + + +
      +
      +system'threading'
      +

      ThreadPool#initializer$inline0

      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
        +
      • +

        Symbol Summary

        +
      Modifier and TypeMethod
      - -setException(Exception ex) +getResultUnsafe()
      - -wait() +setResultValue(T1 r)
      + + + + + + +
      Modifier and TypeName
      + +public   +ThreadPool#initializer$inline0 +
      +
    • +
    +
    +
    + diff --git a/doc/api/system-winforms-summary.html b/doc/api/system-winforms-summary.html index 3228c9fe1a..833dc38f2b 100644 --- a/doc/api/system-winforms-summary.html +++ b/doc/api/system-winforms-summary.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'winforms +ELENA Standard Library 6.4: Module system'winforms diff --git a/doc/api/system-winforms.html b/doc/api/system-winforms.html index 6f05883c58..658495afc5 100644 --- a/doc/api/system-winforms.html +++ b/doc/api/system-winforms.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.3: Module system'winforms +ELENA Standard Library 6.4: Module system'winforms @@ -985,9 +985,9 @@

    Constructor / Static Method Summary

    -internal  SDIApplication +SDIApplication
    -constructor() +new() diff --git a/doc/api/system.html b/doc/api/system.html index 7df9a25d1e..1522dfdba8 100644 --- a/doc/api/system.html +++ b/doc/api/system.html @@ -2,7 +2,7 @@ -ELENA Standard Library 6.0: Module system +ELENA Standard Library 6.4: Module system @@ -19,7 +19,7 @@
    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    @@ -107,20 +107,20 @@

    Constructor / Static Method Summary


    - +
    system'
    -

    Array

    +

    Action<T1>



    -public class Array
    +abstract public template Action<T1>
      @@ -129,109 +129,174 @@

      Array

    • -
    • -
    - +
    • -

      Field Summary

      +

      Conversion Summary

      - + +Func1
      Modifier and TypeFieldConversion Method
      - -array +cast()
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + +abstract   +
      Modifier and TypeConstructor / Static MethodMethod
      -Array -allocate(IntNumber len) +function(T1 arg)
      -Array -copy(IntNumber index, IntNumber length, Array array) +run(Enumerator<T1> en) +
      +Executes the function for every enumeration item
    - +
    +
    + + + +
    +
    +system'
    +

    Action<T1,T1>

    +
    +
    +
    +
    +
    +
    +abstract public template Action<T1,T1>
    +
    +
    + +
    • -

      Static Property Summary

      +

      Conversion Summary

      - + +Func2
      Modifier and TypeStatic PropertyConversion Method
      -get  Array -MinValue() +cast()
    - +
    • -

      Property Summary

      +

      Method Summary

      - + +abstract   - +
      Modifier and TypePropertyMethod
      -get  IntNumber -Length() +function(T1 arg1, T1 arg2) +
      +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    Action<T1,T2>

    +
    +
    +
    +
    +
    +
    +abstract public template Action<T1,T2>
    +
    +
    + + +
      +
    • +

      Conversion Summary

      + + + + + + +Func2
      Modifier and TypeConversion Method
      -get  system'Object[] -Value() +cast()
      @@ -249,54 +314,78 @@

      Method Summary

      -Indexer +abstract  
      -indexer() +function(T1 arg1, T2 arg2) - - - - - -add(Array a) - - + +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    Action<T1,T2,T3>

    +
    +
    +
    +
    +
    +
    +abstract public template Action<T1,T2,T3>
    +
    +
    + + + + +
      +
    • +

      Method Summary

      + + + + - - - - +abstract   @@ -305,20 +394,20 @@

      Method Summary


      - +
      system'
      -

      Array<T1>

      +

      Action<T1,T2,T3,T4>



      -public template Array<T1>
      +abstract public template Action<T1,T2,T3,T4>
        @@ -327,136 +416,219 @@

        Array<T1>

      - +
      • -

        Field Summary

        +

        Conversion Summary

      Modifier and TypeMethod
      -Enumerator -enumerator() - -
      - -Array -clone() +function(T1 arg1, T2 arg2, T3 arg3)
      - + +Func4
      Modifier and TypeFieldConversion Method
      - -array +cast()
    - + +
    +
    + + + +
    +
    +system'
    +

    Action<T1,T2,T3,T4,T5>

    +
    +
    +
    +
    +
    +
    +abstract public template Action<T1,T2,T3,T4,T5>
    +
    +
    + + +
      +
    • +

      Conversion Summary

      + + + + + + + +Func5 +
      Modifier and TypeConversion Method
      -Array<T1> -allocate(IntNumber length) - +cast()
      +
    • +
    + + - +
    +
    + + + +
    +
    +system'
    +

    Array

    +
    +
    +
    +
    +
    +
    +public class Array
    +
    +
    + +
    • -

      Static Property Summary

      +

      Field Summary

      - + + + +
      Modifier and TypeStatic PropertyField
      -get  Array<T1> -Default() +array +
      +
    • +
    + + - +
    - +
    system'
    -

    ArrayEnumerator

    +

    Array<T1>



    -public class ArrayEnumerator
    +public template Array<T1>
    @@ -649,152 +794,98 @@

    Constructor / Static Method Summary

    -ArrayEnumerator + -constructor(Array arr) +copy(T1[] target, T1[] source, IntNumber index, IntNumber length) +
    +Copies a subarray from source starting at index to target
    - - - - -
      -
    • -

      Property Summary

      - - - - - - + + -
      Modifier and TypeProperty
      -get   -Value() +copyTo(T1[] target, T1[] source, IntNumber index, IntNumber length) + +
      +Copies a source array to target at index
      -
    • -
    - - -
    -
    - - - -
    -
    -system'
    -

    ArrayIndexer

    -
    -
    -
    -
    -
    -
    -public class ArrayIndexer
    -
    -
    - - + - +
    • -

      Constructor / Static Method Summary

      +

      Property Summary

      - + +get  IntNumber
      Modifier and TypeConstructor / Static MethodProperty
      -ArrayIndexer -constructor(Array arr) - +Length()
      @@ -803,80 +894,110 @@

      Constructor / Static Method Summary

      • -

        Property Summary

        +

        Conversion Summary

        - + +Enumerable + +
        Modifier and TypePropertyConversion Method
        -get  BoolValue -Available() +cast() +
        +
      • +
      + + - - - - - +
      • -

        Method Summary

        +

        Constructor / Static Method Summary

        - + +ArrayEnumerator
        Modifier and TypeMethodConstructor / Static Method
        -BoolValue -next() +constructor(Array arr)
      -
      -
    - - - -
    -
    -system'
    -

    BaseExtender

    -
    -
    -
    -
    -
    -
    -public class BaseExtender
    -
    -
    - - +
    • -

      Field Summary

      +

      Property Summary

      - + +get  
      Modifier and TypeFieldProperty
      -Object -object +Value()
      @@ -1048,16 +1121,16 @@

      Method Summary

      BoolValue -equal(o) +next() -String + -toPrintable() +reset() @@ -1066,7 +1139,7 @@

      Method Summary

      -dispatch() +enumerable() @@ -1075,20 +1148,20 @@

      Method Summary


    - +
    system'
    -

    BaseIndexer

    +

    ArrayIndexer



    -abstract public class BaseIndexer
    +public class ArrayIndexer
      @@ -1101,7 +1174,7 @@

      BaseIndexer

      • -system'BaseIndexer
      • +system'ArrayIndexer
    @@ -1119,23 +1192,44 @@

    Field Summary

    -Reference<system'IntNumber> +Array
    -index +array -IntNumber +Reference<system'IntNumber>
    -length +index - + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +ArrayIndexer +constructor(Array arr) + +
      +
    • +
    +
    • Property Summary

      @@ -1155,6 +1249,23 @@

      Property Summary

      +get   + +Value() + + + + + +set   + +Value(o) + + + + + + get  IntNumber Index() @@ -1165,7 +1276,7 @@

      Property Summary

      set   -Index(IntNumber value) +Index(IntNumber val) @@ -1194,7 +1305,7 @@

      Method Summary

      -appendIndex(IntNumber disp) +appendIndex(IntNumber val) @@ -1203,20 +1314,20 @@

      Method Summary


    - +
    system'
    -

    BaseIndexer<T1>

    +

    BaseEnumerator



    -abstract public template BaseIndexer<T1>
    +abstract public class BaseEnumerator
    - +
    • -

      Property Summary

      +

      Method Summary

      - + +BoolValue - - - +
      Modifier and TypePropertyMethod
      -get  BoolValue -Available() +next() +
      - -get  IntNumber -Index() -
      +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    BaseEnumerator<T1>

    +
    +
    +
    +
    +
    +
    +abstract public template BaseEnumerator<T1>
    +
    +
    + + +

    - +
    system'
    -

    BaseLazyExpression

    +

    BaseExtender



    -abstract public class BaseLazyExpression
    +public class BaseExtender
      @@ -1373,8 +1522,28 @@

      BaseLazyExpression

      • -system'BaseLazyExpression
      • +system'BaseExtender +
      +
    + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + +Object +object +
    @@ -1389,18 +1558,27 @@

    Method Summary

    - +BoolValue
    -dispatch() +equal(o) -abstract   +String -function() +toPrintable() + + + + + + + + +dispatch() @@ -1409,21 +1587,20 @@

    Method Summary


    - +
    system'
    -

    BaseNumber

    +

    BaseIndexer



    -abstract public class BaseNumber
    -a base numeric value
    +abstract public class BaseIndexer
    - +
    • -

      Property Summary

      +

      Field Summary

      - + +Reference<system'IntNumber> + + + +
      Modifier and TypePropertyField
      -get   -Negative() -
      -Returns the negative value of a number
      +index +
      + +IntNumber +length
    - +
    • -

      Method Summary

      +

      Property Summary

      - + +get  BoolValue +get  IntNumber +set   +get  IntNumber +
      Modifier and TypeMethodProperty
      -abstract   -add(o) - -
      -Adds the value;
      should be overridden
      +Available()
      -abstract   -subtract(o) - -
      -Subtracts the value;
      should be overridden
      +Index()
      -abstract   -multiply(o) +Index(IntNumber value) -
      -Multiplies by the value;
      should be overridden
      -abstract   -divide(o) - -
      -Divides by the value;
      should be overridden
      +Length()
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + - - - - - - - - - - - - @@ -1558,21 +1715,20 @@

      Method Summary


      - +
      system'
      -

      BaseValue

      +

      BaseIndexer<T1>



      -abstract public class BaseValue
      -a base value
      +abstract public template BaseIndexer<T1>
        @@ -1581,83 +1737,125 @@

        BaseValue

      • - +
      • +
      +
      • -

        Method Summary

        +

        Field Summary

      Modifier and TypeMethod
      -add(BaseVariable var) - -
      - - -subtract(BaseVariable var) - -
      - - -multiply(BaseVariable var) - -
      - - -divide(BaseVariable var) +appendIndex(IntNumber disp)
      - + +Reference<system'IntNumber> +IntNumber +
      Modifier and TypeMethodField
      -abstract  BoolValue -less(v) - -
      -Returns true if the object value is less than o; otherwise, false;
      should be overridden
      +index
      -BoolValue -greater(v) - -
      -Returns true if the object value is greater than o; otherwise, false;
      by default sends less[2] to o with the object as an argument
      +length
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + +get  BoolValue +get  IntNumber +set   +get  IntNumber + +
      Modifier and TypeProperty
      -BoolValue -notless(v) - -
      -Returns true if the object value is not less than o; otherwise, false;
      by default inverts the result of less[2] operation
      +Available()
      -BoolValue -notgreater(v) - -
      -Returns true if the object value is not greater than o; otherwise, false;
      by default inverts the result of greater[2] operation
      +Index()
      -BoolValue -equal(BaseVariable var) +Index(IntNumber index) -
      -Returns true if a value of var is equal to the object value; otherwise, false
      -BoolValue -less(BaseVariable var) +Length() +
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + + + + + +
      Modifier and TypeConversion Method
      + +Indexer +cast() +
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + +
      Modifier and TypeMethod
      + + +appendIndex(IntNumber offs) -
      -Returns true if the object value is less than a value of var; otherwise, false
      @@ -1665,21 +1863,20 @@

      Method Summary


    - +
    system'
    -

    BaseVariable

    +

    BaseLazyExpression



    -abstract public class BaseVariable
    -variable base class
    +abstract public class BaseLazyExpression
      @@ -1688,38 +1885,35 @@

      BaseVariable

      • -system'BaseVariable
      • +system'BaseLazyExpression
    - +
    • -

      Property Summary

      +

      Method Summary

      - + + +abstract  
      Modifier and TypePropertyMethod
      -get abstract   -Value() -
      -Returns the variable value;
      should be overridden
      +dispatch() +
      -set abstract   -Value(o) +function() -
      -Set the variable value;
      should be overridden
      @@ -1727,20 +1921,21 @@

      Property Summary


    - +
    system'
    -

    BitArray

    +

    BaseNumber



    -public class BitArray
    +abstract public class BaseNumber
    +a base numeric value
      @@ -1749,57 +1944,14 @@

      BitArray

      • -system'BitArray
      • -
      -
    • +system'BaseValue +
    • +
        +
      • +system'BaseNumber
      - - - -
        -
      • -

        Constructor / Static Method Summary

        - - - - - - - - - -
        Modifier and TypeConstructor / Static Method
        - -BitArray -allocate(IntNumber length) - -
      @@ -1814,9 +1966,11 @@

      Property Summary

      -get  IntNumber +get  
      -Length() +Negative() +
      +Returns the negative value of a number
      @@ -1834,45 +1988,80 @@

      Method Summary

      - +abstract   -at(index) +add(o) +
      +Adds the value;
      should be overridden
      -BoolValue +abstract  
      -at(IntNumber index) +subtract(o) +
      +Subtracts the value;
      should be overridden
      - +abstract  
      -setAt(IntNumber index, BoolValue value) +multiply(o) +
      +Multiplies by the value;
      should be overridden
      -Enumerator<system'BoolValue> +abstract  
      -enumerator() +divide(o) +
      +Divides by the value;
      should be overridden
      -Indexer<system'BoolValue> +
      -indexer() +add(BaseVariable var) + + + + + + + + +subtract(BaseVariable var) + + + + + + + + +multiply(BaseVariable var) + + + + + + + + +divide(BaseVariable var) @@ -1881,20 +2070,21 @@

      Method Summary


    - +
    system'
    -

    BitArray32

    +

    BaseValue



    -public class BitArray32
    +abstract public class BaseValue
    +a base value
      @@ -1903,87 +2093,50 @@

      BitArray32

      • -system'BitArray32
      • -
      -
    • +system'BaseValue
    - -
      -
    • -

      Field Summary

      - - - - - - - - - -
      Modifier and TypeField
      - -IntNumber -_value -
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + +abstract  BoolValue -
      Modifier and TypeConstructor / Static MethodMethod
      -BitArray32 -load(IntNumber value) +less(v) +
      +Returns true if the object value is less than o; otherwise, false;
      should be overridden
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - + +BoolValue -
      Modifier and TypeProperty
      -get  IntNumber -Length() +greater(v) + +
      +Returns true if the object value is greater than o; otherwise, false;
      by default sends less[2] to o with the object as an argument
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - +BoolValue @@ -1991,35 +2144,94 @@

      Method Summary

      BoolValue +BoolValue +BoolValue +
      Modifier and TypeMethod
      - -write(IntNumber value) +notless(v) +
      +Returns true if the object value is not less than o; otherwise, false;
      by default inverts the result of less[2] operation
      -at(IntNumber index) +notgreater(v) +
      +Returns true if the object value is not greater than o; otherwise, false;
      by default inverts the result of greater[2] operation
      - -setAt(IntNumber index, BoolValue value) +equal(BaseVariable var) +
      +Returns true if a value of var is equal to the object value; otherwise, false
      -Enumerator<system'BoolValue> -enumerator() +less(BaseVariable var) +
      +Returns true if the object value is less than a value of var; otherwise, false
      +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    BaseVariable

    +
    +
    +
    +
    +
    +
    +abstract public class BaseVariable
    +variable base class
    +
    +
    + + +
      +
    • +

      Property Summary

      + + + + + +get abstract   + + + +
      Modifier and TypeProperty
      -Indexer<system'BoolValue> -indexer() +Value() +
      +Returns the variable value;
      should be overridden
      +
      + +set abstract   +Value(o) +
      +Set the variable value;
      should be overridden
      @@ -2027,21 +2239,20 @@

      Method Summary


    - +
    system'
    -

    BoolValue

    +

    BitArray



    -abstract public class BoolValue
    -a common boolean value
    +public class BitArray
      @@ -2050,47 +2261,54 @@

      BoolValue

      • -system'BoolValue
      • +system'BitArray
    - +
    • -

      Static Property Summary

      +

      Field Summary

      - + +system'IntNumber[] +IntNumber +
      Modifier and TypeStatic PropertyField
      -get  BoolValue -MinValue() -
      -Returns the default value
      +_array
      -get  BoolValue -true() -
      -Returns true value
      +_length
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + +BitArray
      Modifier and TypeConstructor / Static Method
      -get  BoolValue -false() -
      -Returns false value.
      +allocate(IntNumber length) +
      @@ -2108,11 +2326,9 @@

      Property Summary

      -get abstract  BoolValue +get  IntNumber
      -Inverted() -
      -Inverts the value;
      has to be implemented
      +Length() @@ -2130,109 +2346,46 @@

      Method Summary

      -abstract   + -if(trueAction) +at(index) -
      -Executes trueAction if the value is true;
      has to be implemented
      -abstract   +BoolValue
      -if(trueAction, falseAction) +at(IntNumber index) -
      -Executes trueAction if the value is true or falseAction otherwise;
      has to be implemented
      -abstract   +
      -ifnot(trueAction) +setAt(IntNumber index, BoolValue value) -
      -Executes an action if the value is false;
      has to be implemented
      -abstract   +Enumerator<system'BoolValue>
      -iif(Object trueVal, Object falseVal) +enumerator() -
      -Returns trueVal if the value is true or falseVal otherwise;
      has to be implemented
      -abstract  BoolValue - -equal(BoolValue f) - -
      -Determines whether the specified object is equal to the current object boolean value;
      has to be implemented
      - - - - - -abstract  BoolValue - -notequal(BoolValue f) - - - - - - -abstract  BoolValue - -or(expr) - -
      -Executes logical OR operation<;br/>has to be implemented
      - - - - - -abstract  BoolValue - -and(expr) - -
      -Executes logical AND operation;
      has to be implemented
      - - - - - -abstract  BoolValue - -xor(expr) - -
      -Executes logical XOR operation;
      has to be implemented
      - - - - - -abstract  BoolValue +Indexer<system'BoolValue>
      -clone() +indexer() -
      -clones the value;
      has to be implemented
      @@ -2240,20 +2393,20 @@

      Method Summary


    - +
    system'
    -

    BoolValue#false

    +

    BitArray32



    -public singleton BoolValue#false
    +public class BitArray32
      @@ -2262,119 +2415,86 @@

      BoolValue#false

    - +
    • -

      Property Summary

      +

      Field Summary

      - + +IntNumber
      Modifier and TypePropertyField
      -get  BoolValue -Inverted() -
      -Always returns true
      +_value
    - +
    • -

      Method Summary

      +

      Constructor / Static Method Summary

      - + +BitArray32 - - - +
      Modifier and TypeMethodConstructor / Static Method
      -String -toPrintable() +load(IntNumber value) -
      -Returns literal representation
      - - -if(trueAction) - -
      -Always returns nil
      -
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + +get  IntNumber - - - +
      Modifier and TypeProperty
      - -if(trueAction, elseAction) - -
      -Executes else-action
      +Length()
      - - -ifnot(trueAction) - -
      -Executes the action
      -
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + - - - - - - - - @@ -2383,40 +2503,34 @@

      Method Summary

      BoolValue + +Enumerator<system'BoolValue> +Indexer<system'BoolValue> @@ -2425,20 +2539,21 @@

      Method Summary


      - +
      system'
      -

      BoolValue#true

      +

      BoolValue



      -public singleton BoolValue#true
      +abstract public class BoolValue
      +a common boolean value
        @@ -2447,14 +2562,50 @@

        BoolValue#true

      • + +
          +
        • +

          Static Property Summary

          +
      Modifier and TypeMethod
      -iif(Object trueVal, Object falseVal) - -
      -Always returns falseVal.
      -
      - -BoolValue -equal(BoolValue b) - -
      -Determines whether the specified object is equal to the current object boolean value
      -
      - -BoolValue -notequal(BoolValue b) +write(IntNumber value)
      -or(expr) +at(IntNumber index) -
      -Executes logical OR operation
      -BoolValue -and(expr) +setAt(IntNumber index, BoolValue value) -
      -Executes logical AND operation;
      Always return false
      -BoolValue -xor(expr) +enumerator() -
      -Executes logical XOR operation
      -BoolValue -clone() +indexer()
      + + + + + + + + + + + + + + + + +
      Modifier and TypeStatic Property
      + +get  BoolValue +MinValue() +
      +Returns the default value
      +
      + +get  BoolValue +true() +
      +Returns true value
      +
      + +get  BoolValue +false() +
      +Returns false value.
      +
    @@ -2469,11 +2620,11 @@

    Property Summary

    -get  BoolValue +get abstract  BoolValue
    Inverted()
    -Always returns false.
    +Inverts the value;
    has to be implemented
    @@ -2491,118 +2642,109 @@

    Method Summary

    -String +abstract  
    -toPrintable() +if(trueAction)
    -Returns literal representation.
    +Executes trueAction if the value is true;
    has to be implemented - +abstract  
    -if(trueAction) +if(trueAction, falseAction)
    -Executes trueAction.
    +Executes trueAction if the value is true or falseAction otherwise;
    has to be implemented - +abstract  
    -if(trueAction, elseAction) +ifnot(trueAction)
    -Executes trueAction.
    +Executes an action if the value is false;
    has to be implemented - +abstract  
    -ifnot(trueAction) +iif(Object trueVal, Object falseVal)
    -Always returns nil.
    +Returns trueVal if the value is true or falseVal otherwise;
    has to be implemented - +abstract  BoolValue
    -iif(Object trueVal, Object falseVal) +equal(BoolValue f)
    -Always returns trueVal.
    +Determines whether the specified object is equal to the current object boolean value;
    has to be implemented -BoolValue +abstract  BoolValue
    -equal(BoolValue b) +notequal(BoolValue f) -
    -Determines whether the specified object is equal to the current object boolean value.
    -BoolValue - -notequal(BoolValue b) - - - - - - -BoolValue +abstract  BoolValue
    or(expr)
    -Executes logical OR operation;
    Always return true
    +Executes logical OR operation<;br/>has to be implemented - + -BoolValue +abstract  BoolValue
    and(expr)
    -executes logical AND operation.
    +Executes logical AND operation;
    has to be implemented - + -BoolValue +abstract  BoolValue
    xor(expr)
    -Executes logical XOR operation.
    +Executes logical XOR operation;
    has to be implemented - + -BoolValue +abstract  BoolValue clone() +
    +clones the value;
    has to be implemented
    @@ -2610,20 +2752,20 @@

    Method Summary


    - +
    system'
    -

    byteArrayConvertor

    +

    BoolValue#false



    -public singleton byteArrayConvertor
    +public singleton BoolValue#false
      @@ -2632,59 +2774,38 @@

      byteArrayConvertor

    • - +
    • +
    + -
    -
    - - - -
    -
    -system'
    -

    byteConvertor

    -
    -
    -
    -
    -
    -
    -public singleton byteConvertor
    -
    -
    -
    - +
    system'
    -

    ByteNumber

    +

    BoolValue#true



    -public class ByteNumber
    -an unsigned 8 bit integer
    +public singleton BoolValue#true
    - +
    • -

      Field Summary

      +

      Property Summary

      - + +get  BoolValue
      Modifier and TypeFieldProperty
      - -_value +Inverted() +
      +Always returns false.
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + +String + + - -
      Modifier and TypeConstructor / Static MethodMethod
      -ByteNumber -constructor() +toPrintable()
      -Returns the default value
      +Returns literal representation.
      -ByteNumber -constructor(ByteNumber b) +if(trueAction)
      -Creates the object with a specified value
      +Executes trueAction.
      -ByteNumber -constructor(IntNumber n) +if(trueAction, elseAction)
      -Creates the object with a specified value
      -
      -
    • -
    - -
      -
    • -

      Static Property Summary

      - - - - - - - - + + -
      Modifier and TypeStatic Property
      - -get  ByteNumber -MinValue() -
      -returns the minimal value (0)
      +Executes trueAction.
      -get  ByteNumber -MaxValue() +ifnot(trueAction) +
      -Returns the maxial value (255)
      +Always returns nil.
      -get  ByteNumber -Default() +iif(Object trueVal, Object falseVal) + +
      +Always returns trueVal.
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - - - + +BoolValue -
      Modifier and TypeProperty
      -get  ByteNumber -BInverted() +equal(BoolValue b) +
      -bitwise inversion
      +Determines whether the specified object is equal to the current object boolean value.
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - +BoolValue +BoolValue +BoolValue +BoolValue +BoolValue
      Modifier and TypeConversion Method
      -ShortNumber -cast() -
      -Returns the value as a short integer
      +notequal(BoolValue b) +
      -IntNumber -cast() +or(expr) +
      -returns the value as an integer
      +Executes logical OR operation;
      Always return true
      -UIntNumber -cast() +and(expr) +
      -returns the value as an unsigned integer
      +executes logical AND operation.
      -LongNumber -cast() +xor(expr) +
      -Returns the value as a long integer
      +Executes logical XOR operation.
      -RealNumber -cast() -
      -Returns the value as a real number
      +clone() +
    +
    +
    + + + +
    +
    +system'
    +

    byteArrayConvertor

    +
    +
    +
    +
    +
    +
    +public singleton byteArrayConvertor
    +
    +
    +
    +
    +
    + + + +
    +
    +system'
    +

    byteConvertor

    +
    +
    +
    +
    +
    +
    +public singleton byteConvertor
    +
    +
    + + + +
    +
    + + + +
    +
    +system'
    +

    ByteNumber

    +
    +
    +
    +
    +
    +
    +public class ByteNumber
    +an unsigned 8 bit integer
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + - +
      Modifier and TypeField
      -IntNumber -add(IntNumber n) - -
      -Returns the sum
      +_value
      +
    • +
    + + + + + +
      +
    • +

      Property Summary

      + + + + + + +get  ByteNumber +
      Modifier and TypeProperty
      -IntNumber -divide(LongNumber n) - +BInverted()
      -Returns the result of integer division
      +bitwise inversion
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + +ShortNumber +IntNumber +UIntNumber + + + + +
      Modifier and TypeConversion Method
      -RealNumber -add(RealNumber n) - +cast()
      -Returns the sum
      +Returns the value as a short integer
      -RealNumber -subtract(RealNumber n) - +cast()
      -Returns the difference
      +returns the value as an integer
      -RealNumber -multiply(RealNumber n) - +cast()
      -Returns the product
      +returns the value as an unsigned integer
      +LongNumber +cast() +
      +Returns the value as a long integer
      +
      + RealNumber -divide(RealNumber n) - +cast()
      -Returns the result of integer division
      +Returns the value as a real number
      +
    • +
    + + - - -
    -
    - - - -
    -
    -system'
    -

    CallStack

    -
    -
    -
    -
    -
    -
    -public class CallStack
    -A call stack
    -
    -
    - - - - - - -
      -
    • -

      Method Summary

      - - - - - +ByteNumber -
      Modifier and TypeMethod
      -String -toPrintable() +bxor(ByteNumber n)
      -Generates the call stack literal representation
      +Returns the result of bitwise XOR operation
      -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    charConvertor

    -
    -
    -
    -
    -
    -
    -public singleton charConvertor
    -
    -
    - - - -
    -
    - - - -
    -
    -system'
    -

    CharValue

    -
    -
    -
    -
    -
    -
    -public class CharValue
    -An UTF-32 character symbol
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - - - + +LongNumber -
      Modifier and TypeField
      - -_value +bxor(LongNumber n) + +
      +Returns the result of bitwise XOR operation
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - +ByteNumber +ByteNumber +ByteNumber
      Modifier and TypeConstructor / Static Method
      -CharValue -constructor() +shiftLeft(IntNumber val)
      -Creates the object with a default value (0)
      +shifts an integer value to the left by a specified number of bits
      -CharValue -constructor(CharValue value) +shiftRight(IntNumber val)
      -Creates the object with specified value
      +shifts an integer value to the right by a specified number of bits
      -CharValue -load(IntNumber n) +clone()
      -Creates the object with specified numeric value
      +clones the value
    - +
    • -

      Static Property Summary

      +

      Extension Summary

      - + +get property  IntNumber +get property  ByteNumber +ByteNumber -
      Modifier and TypeStatic PropertyExtension Method
      -get  CharValue -MinValue() -
      -Returns the minimal possible character value (0)
      +Hashcode()
      -get  CharValue -MaxValue() -
      -Returns the maximal possible character value (010FFFFh)
      +Absolute()
      -get  CharValue -Default() +power(IntNumber y) +
      -
    • -
    - -
      -
    • -

      Property Summary

      - - - - + + + +ByteNumber +ByteNumber +BoolValue - -
      Modifier and TypeProperty
      + +ByteNumber +sqr() + +
      -get internal  IntNumber -Value() +sqrt() +
      -get  IntNumber -Length() -
      -Retuns the number of bytes to represent the symbol in UTF-8
      +mod(Object operand) +
      -get  IntNumber -WideLength() -
      -Retuns the number of bytes to represent the symbol in UTF-16
      -
      -
    • -
    - -
      -
    • -

      Conversion Summary

      - - - - - - - - - - - - - -
      Modifier and TypeConversion Method
      - -String -cast() -
      - -WideString -cast() -
      -
    • -
    - - - -
      -
    • -

      Extension Summary

      - - - - - - - - @@ -4333,7 +4268,7 @@

      Extension Summary

      BoolValue @@ -4342,7 +4277,7 @@

      Extension Summary

      BoolValue @@ -4351,7 +4286,7 @@

      Extension Summary

      BoolValue @@ -4360,20 +4295,21 @@

      Extension Summary


      - +
      system'
      -

      ClassReference

      +

      CallStack



      -public class ClassReference
      +public class CallStack
      +A call stack
        @@ -4382,7 +4318,7 @@

        ClassReference

        • -system'ClassReference
        • +system'CallStack
      @@ -4398,9 +4334,9 @@

      Field Summary

      +system'UnsafePointer[]
      Modifier and TypeExtension Method
      - -get property  IntNumber -Hashcode()
      -isWhitespace() +isPositive()
      -isDigit() +isNegative()
      -isLToken() +isNonnegative()
      - -pointer +stack
      @@ -4418,12 +4354,19 @@

      Constructor / Static Method Summary

      -ClassReference +CallStack
      -constructor(String name) +constructor() + + + + + + +CallStack + +constructor(IntNumber trimingLevel) -
      -Loads a symbol
      @@ -4441,10 +4384,12 @@

      Method Summary

      - +String
      -dispatch() +toPrintable() +
      +Generates the call stack literal representation
      @@ -4452,20 +4397,20 @@

      Method Summary


    - +
    system'
    -

    Console

    +

    charConvertor



    -public class Console
    +public singleton charConvertor
      @@ -4474,113 +4419,66 @@

      Console

      • -system'Console
      • +system'charConvertor
    - + - - - -
      -
    • -

      Property Summary

      - - - - - - + +CharValue -
      Modifier and TypeProperty
      -get  BoolValue -KeyAvailable() +convert(String s) + +
      +Converts a literal string into a character
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - +CharValue - - - - - - - - @@ -4588,37 +4486,17 @@

      Method Summary

      CharValue - - - - - - - - +CharValue
      Modifier and TypeMethod
      - -write(s) - -
      - - -writeLine(s) - -
      - - -writeLine() +convert(WideString s) +
      +Converts a wide string into a character
      -readChar() - -
      - - -setCursorPosition(IntNumber x, IntNumber y) - -
      - - -clear() +convert(ShortNumber w)
      -String -readLine() +convert(ByteNumber b) -
      -Reads the next line of characters from the standard input stream.
      @@ -4626,20 +4504,21 @@

      Method Summary


    - +
    system'
    -

    COORD

    +

    CharValue



    -public class COORD
    +public class CharValue
    +An UTF-32 character symbol
      @@ -4648,7 +4527,13 @@

      COORD

    @@ -4664,17 +4549,9 @@

    Field Summary

    -ShortNumber - -_x - - - - - -ShortNumber +
    -_y +_value @@ -4692,233 +4569,319 @@

    Constructor / Static Method Summary

    -COORD +CharValue
    constructor() +
    +Creates the object with a default value (0)
    - - - - - - +
    • -

      Method Summary

      +

      Static Property Summary

      - + +get  CharValue +get  CharValue + + + +
      Modifier and TypeMethodStatic Property
      - -write(ShortNumber x, ShortNumber y) - +MinValue() +
      +Returns the minimal possible character value (0)
      - -write(COORD r) - +MaxValue() +
      +Returns the maximal possible character value (010FFFFh)
      +
      + +get  CharValue +Default()
    -
    -
    - - - -
    -
    -system'
    -

    CriticalException

    -
    -
    -
    -
    -
    -
    -public class CriticalException
    -
    -
    - - +
    • -

      Field Summary

      +

      Property Summary

      - + +get internal  IntNumber +get  IntNumber -
      Modifier and TypeFieldProperty
      -String -message +Value()
      -CallStack -callStack +Length() +
      +Retuns the number of bytes to represent the symbol in UTF-8
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - +get  IntNumber
      Modifier and TypeConstructor / Static Method
      -CriticalException -new() - +WideLength() +
      +Retuns the number of bytes to represent the symbol in UTF-16
    -
    -
    - - - -
    -
    -system'
    -

    DivisionByZeroException

    -
    -
    -
    -
    -
    -
    -public class DivisionByZeroException
    -
    -
    - - +
    • -

      Field Summary

      +

      Conversion Summary

      - + +WideString
      Modifier and TypeFieldConversion Method
      String -message +cast()
      -CallStack -callStack +cast()
    - + + +
      +
    • +

      Extension Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4927,20 +4890,20 @@

      Constructor / Static Method Summary


      - +
      system'
      -

      Enumerable

      +

      ClassReference



      -abstract public class Enumerable
      +public class ClassReference
        @@ -4949,57 +4912,51 @@

        Enumerable

        • -system'Enumerable
        • +system'ClassReference
      - +
      • -

        Method Summary

        +

        Field Summary

      Modifier and TypeExtension Method
      + +get property  IntNumber +Hashcode() +
      + +BoolValue +isNewLine() + +
      + +BoolValue +isWhitespace() + +
      + +BoolValue +isDigit() + +
      + +BoolValue +isLetter() + +
      + +BoolValue +isLToken()
      - + +
      Modifier and TypeMethodField
      -abstract  Enumerator -enumerator() - +pointer
    -
    -
    - - - -
    -
    -system'
    -

    Enumerable<T1>

    -
    -
    -
    -
    -
    -
    -abstract public template Enumerable<T1>
    -
    -
    -
      -
    • -system'Object
    • -
    • -
        -
      • -system'Enumerable<T1>
      • -
      + +
        +
      • +

        Constructor / Static Method Summary

        + + + + + + + + + +
        Modifier and TypeConstructor / Static Method
        + +ClassReference +constructor(String name) + +
        +Loads a symbol
        +
      @@ -5014,9 +4971,9 @@

      Method Summary

      -abstract  Enumerator<T1> + -enumerator() +dispatch() @@ -5025,21 +4982,20 @@

      Method Summary


    - +
    system'
    -

    Enumerator

    +

    Console



    -abstract public class Enumerator
    -An enumerator prototype
    +public singleton Console
      @@ -5048,7 +5004,7 @@

      Enumerator

      • -system'Enumerator
      • +system'Console
    @@ -5064,11 +5020,9 @@

    Property Summary

    -get abstract   +get  BoolValue
    -Value() -
    -Returns the current object
    +KeyAvailable() @@ -5086,43 +5040,83 @@

    Method Summary

    -abstract  BoolValue + -next() +write(s)
    -Goes to the next enumeration member and returns true if it is not the last member
    +Writes the specified literal value to the standard output stream.
    -abstract   + -reset() +writeLine(s)
    -Resets the enumerator
    +Writes the specified literal value, followed by the current line terminator, to the standard output stream. -abstract   +
    -enumerable() +writeLine() + + + + + + +CharValue + +readChar()
    -returns the enumerator owner
    +Reads the next character from the input stream + + + + + + + +setCursorPosition(IntNumber x, IntNumber y) + -Enumerator +
    -enumerator() +clear() + + + + + + +String + +readLine() + +
    +Reads the next line of characters from the standard input stream.
    + + + + + +WideString + +readWideLine() +
    +Reads the next line of characters from the standard input stream.
    @@ -5130,20 +5124,20 @@

    Method Summary


    - +
    system'
    -

    Enumerator<T1>

    +

    ConsoleHelperImpl



    -abstract public template Enumerator<T1>
    +public class ConsoleHelperImpl
      @@ -5152,25 +5146,54 @@

      Enumerator<T1>

      • -system'Enumerator<T1>
      • +system'ConsoleHelperImpl
    - +
    • -

      Property Summary

      +

      Field Summary

      - + +IConsoleReader + + + + + +
      Modifier and TypePropertyField
      -get abstract  T1 -Value() +reader +
      + +IConsoleWriter +writer +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +ConsoleHelperImpl +new(IConsoleReader reader, IConsoleWriter writer) +
      @@ -5179,18 +5202,18 @@

      Property Summary

      • -

        Conversion Summary

        +

        Property Summary

        - + +get  BoolValue
        Modifier and TypeConversion MethodProperty
        -abstract  Enumerator -cast() +KeyAvailable()
        @@ -5208,37 +5231,83 @@

        Method Summary

        -abstract  BoolValue +
        -next() +write(s) +
        +Writes the specified literal value to the standard output stream.
        -abstract   +
        -reset() +writeLine(s) +
        +Writes the specified literal value, followed by the current line terminator, to the standard output stream.
        -abstract   +
        -enumerable() +writeLine() -Enumerator<T1> +CharValue -enumerator() +readChar() + +
        +Reads the next character from the input stream
        + + + + + + + +setCursorPosition(IntNumber x, IntNumber y) + + + + + + + + +clear() + + + + + + +String + +readLine() + +
        +Reads the next line of characters from the standard input stream.
        + + + + + +WideString + +readWideLine() +
        +Reads the next line of characters from the standard input stream.
        @@ -5246,20 +5315,20 @@

        Method Summary


    - +
    system'
    -

    Exception

    +

    COORD



    -public class Exception
    +public class COORD
      @@ -5268,7 +5337,7 @@

      Exception

      • -system'Exception
      • +system'COORD
    @@ -5284,17 +5353,17 @@

    Field Summary

    -String +ShortNumber
    -message +_x -CallStack +ShortNumber -callStack +_y @@ -5312,36 +5381,9 @@

    Constructor / Static Method Summary

    - - -raise() - - - - - - - - -raise(String message) - - - - - - -Exception - -new(String message) - - - - - - -Exception +COORD -new() +constructor() @@ -5360,9 +5402,17 @@

    Property Summary

    -get  String +get  ShortNumber
    -Message() +X() + + + + + +get  ShortNumber + +Y() @@ -5380,27 +5430,9 @@

    Method Summary

    -String - -toPrintable() - - - - - - - - -on(handler) - - - - - - -fallback(arg) +write(ShortNumber x, ShortNumber y) @@ -5409,7 +5441,7 @@

    Method Summary

    -raise() +write(COORD r) @@ -5418,20 +5450,20 @@

    Method Summary


    - +
    system'
    -

    Extension

    +

    CriticalException



    -public class Extension
    +public class CriticalException
      @@ -5440,7 +5472,13 @@

      Extension

    @@ -5456,17 +5494,17 @@

    Field Summary

    -Object +String
    -target +message -Object +CallStack
    -extender +callStack @@ -5484,30 +5522,9 @@

    Constructor / Static Method Summary

    -Extension - -constructor(target, extender) - - - - - - - -
      -
    • -

      Method Summary

      - - - - - - - +CriticalException @@ -5516,21 +5533,20 @@

      Method Summary


      - +
      system'
      -

      ExtensionMessage

      +

      DivisionByZeroException



      -public class ExtensionMessage
      -An extended message constant
      +public class DivisionByZeroException
        @@ -5539,7 +5555,13 @@

        ExtensionMessage

        • -system'ExtensionMessage
        • +system'Exception +
        • +
            +
          • +system'DivisionByZeroException
          • +
          +
      @@ -5555,32 +5577,38 @@

      Field Summary

      +String + + + +
      Modifier and TypeMethod
      - - -dispatch() +new()
      - -value +message +
      + +CallStack +callStack
    - +
    • -

      Method Summary

      +

      Constructor / Static Method Summary

      - + +DivisionByZeroException
      Modifier and TypeMethodConstructor / Static Method
      - -dispatch() +new() -
      -Dequalifies incoming messages if they are equal to its value and redirects to the target
      @@ -5588,20 +5616,20 @@

      Method Summary


    - +
    system'
    -

    ExtensionVariable

    +

    Enumerable



    -public class ExtensionVariable
    +abstract public class Enumerable
      @@ -5610,57 +5638,8 @@

      ExtensionVariable

      • -system'ExtensionVariable
      • -
      -
    • -
    - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -Object -target -
      - -Object -extension -
      -
    • +system'Enumerable
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - - - -
      Modifier and TypeConstructor / Static Method
      - -ExtensionVariable -constructor(target, extension) - -
    @@ -5675,9 +5654,9 @@

    Method Summary

    - +abstract  Enumerator -dispatch() +enumerator() @@ -5686,20 +5665,20 @@

    Method Summary


    - +
    system'
    -

    FormatException

    +

    Enumerable<T1>



    -public class FormatException
    +abstract public template Enumerable<T1>
      @@ -5708,68 +5687,25 @@

      FormatException

    • -
    • +system'Enumerable<T1>
    - -
      -
    • -

      Field Summary

      - - - - - - - - - - - - - -
      Modifier and TypeField
      - -String -message -
      - -CallStack -callStack -
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + - - - - +abstract  Enumerator<T1> @@ -5778,21 +5714,21 @@

      Constructor / Static Method Summary


      - +
      system'
      -

      Func

      +

      Enumerator



      -abstract public class Func
      -A base action
      +abstract public class Enumerator
      +An enumerator prototype
        @@ -5801,10 +5737,32 @@

        Func

        • -system'Func
        • +system'Enumerator
      + +
        +
      • +

        Property Summary

        +
      Modifier and TypeConstructor / Static MethodMethod
      -FormatException -new() - -
      - -FormatException -new(String message) +enumerator()
      + + + + + + + + +
      Modifier and TypeProperty
      + +get abstract   +Value() +
      +Returns the current object
      +
      +
    • +
    • @@ -5817,27 +5775,42 @@

      Method Summary

      -abstract   +abstract  BoolValue
      -function() +next() +
      +Goes to the next enumeration member and returns true if it is not the last member
      - +abstract  
      -doWhile(b) +reset() +
      +Resets the enumerator
      - +abstract  
      -doUntil(b) +enumerable() + +
      +returns the enumerator owner
      + + + + + +Enumerator + +enumerator() @@ -5846,20 +5819,20 @@

      Method Summary


    - +
    system'
    -

    Func<T1,T2>

    +

    Enumerator<T1>



    -abstract public template Func<T1,T2>
    +abstract public template Enumerator<T1>
      @@ -5868,23 +5841,45 @@

      Func<T1,T2>

      • -system'Func<T1,T2>
      • +system'Enumerator<T1>
    • -

      Conversion Summary

      +

      Property Summary

      - + +get abstract  T1 + + +
      Modifier and TypeConversion MethodProperty
      -Func1 +Value() +
      +Returns the current object
      +
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + + + @@ -5904,21 +5899,37 @@

      Method Summary

      +abstract  BoolValue +abstract   + + + + + + + +
      Modifier and TypeConversion Method
      + +abstract  Enumerator cast()
      -abstract  T2 -function(T1 arg) +next()
      - -run(Enumerator<T1> en) +reset() + +
      + +abstract   +enumerable() + +
      + +Enumerator<T1> +enumerator() -
      -Executes the function for every enumeration item
      @@ -5926,20 +5937,21 @@

      Method Summary


    - +
    system'
    -

    Func<T1,T2,T3>

    +

    Exception



    -abstract public template Func<T1,T2,T3>
    +public class Exception
    +A basic exception
      @@ -5948,94 +5960,101 @@

      Func<T1,T2,T3>

      • -system'Func<T1,T2,T3>
      • +system'Exception
    - +
    • -

      Conversion Summary

      +

      Field Summary

      - + +String + + + +
      Modifier and TypeConversion MethodField
      -Func2 -cast() +message +
      + +CallStack +callStack
    - +
    • -

      Method Summary

      +

      Constructor / Static Method Summary

      - + + + + + + + + + + + + + +
      Modifier and TypeMethodConstructor / Static Method
      -abstract  T3 -function(T1 arg1, T2 arg2) +raise() + +
      + + +raise(String message) + +
      + +Exception +new(String message) + +
      + +Exception +new()
    -
    -
    - - - -
    -
    -system'
    -

    Func<T1,T2,T3,T4>

    -
    -
    -
    -
    -
    -
    -abstract public template Func<T1,T2,T3,T4>
    -
    -
    -
    • -

      Conversion Summary

      +

      Property Summary

      - + +get  String
      Modifier and TypeConversion MethodProperty
      -Func3 -cast() +Message()
      @@ -6053,9 +6072,38 @@

      Method Summary

      -abstract  T4 +String
      -function(T1 arg1, T2 arg2, T3 arg3) +toPrintable() + +
      +Returns the message and the call stack
      + + + + + + + +on(handler) + + + + + + + + +fallback(arg) + + + + + + + + +raise() @@ -6064,20 +6112,20 @@

      Method Summary


    - +
    system'
    -

    Func<T1,T2,T3,T4,T5>

    +

    Extension



    -abstract public template Func<T1,T2,T3,T4,T5>
    +public class Extension
      @@ -6086,25 +6134,54 @@

      Func<T1,T2,T3,T4,T5><
      • -system'Func<T1,T2,T3,T4,T5>
      • +system'Extension
    - +
    • -

      Conversion Summary

      +

      Field Summary

      - + +Object + + + + + +
      Modifier and TypeConversion MethodField
      -Func4 -cast() +target +
      + +Object +extender +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +Extension +constructor(target, extender) +
      @@ -6122,9 +6199,9 @@

      Method Summary

      -abstract  T5 +
      -function(T1 arg1, T2 arg2, T3 arg3, T4 arg4) +dispatch() @@ -6133,20 +6210,21 @@

      Method Summary


    - +
    system'
    -

    Func<T1,T2,T3,T4,T5,T6>

    +

    ExtensionMessage



    -abstract public template Func<T1,T2,T3,T4,T5,T6>
    +public class ExtensionMessage
    +An extended message constant
      @@ -6155,25 +6233,25 @@

      Func<T1,T2,T3,T4,T5,T
      • -system'Func<T1,T2,T3,T4,T5,T6>
      • +system'ExtensionMessage
    - +
    • -

      Conversion Summary

      +

      Field Summary

      - + +
      Modifier and TypeConversion MethodField
      -Func5 -cast() +value
      @@ -6191,10 +6269,12 @@

      Method Summary

      -abstract  T6 +
      -function(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) +dispatch() +
      +Dequalifies incoming messages if they are equal to its value and redirects to the target
      @@ -6202,20 +6282,20 @@

      Method Summary


    - +
    system'
    -

    Func1

    +

    ExtensionVariable



    -abstract public class Func1
    +public class ExtensionVariable
      @@ -6224,45 +6304,74 @@

      Func1

      • -system'Func1
      • +system'ExtensionVariable
    - +
    • -

      Method Summary

      +

      Field Summary

      - + +Object +Object + +
      Modifier and TypeMethodField
      -abstract   -function(arg1) - +target
      - -run(Enumerator en) +extension +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +ExtensionVariable +constructor(target, extension) -
      -Executes the function for every enumeration item
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + @@ -6271,20 +6380,20 @@

      Method Summary


      - +
      system'
      -

      Func10

      +

      FormatException



      -abstract public class Func10
      +public class FormatException
        @@ -6293,43 +6402,68 @@

        Func10

      • - +
      • +
      +
      • -

        Method Summary

        +

        Field Summary

      Modifier and TypeMethod
      -retrieve(Enumerator en) +dispatch()
      - + +String +CallStack +
      Modifier and TypeMethodField
      -abstract   -function(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) - +message
      - -run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Enumerator en) - +callStack
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + +FormatException + + + + @@ -6338,20 +6472,21 @@

      Method Summary


      - +
      system'
      -

      Func11

      +

      Func



      -abstract public class Func11
      +abstract public class Func
      +A base action
        @@ -6360,7 +6495,7 @@

        Func11

        • -system'Func11
        • +system'Func
      @@ -6378,7 +6513,7 @@

      Method Summary

      abstract  
      @@ -6387,7 +6522,7 @@

      Method Summary

      @@ -6396,7 +6531,7 @@

      Method Summary

      @@ -6405,20 +6540,20 @@

      Method Summary


      - +
      system'
      -

      Func2

      +

      Func<T1,T1,system'IntNumber>



      -abstract public class Func2
      +abstract public template Func<T1,T1,system'IntNumber>
        @@ -6427,7 +6562,13 @@

        Func2

      @@ -6443,27 +6584,9 @@

      Method Summary

      - - - - - - - - +abstract  IntNumber @@ -6472,20 +6595,20 @@

      Method Summary


      - +
      system'
      -

      Func3

      +

      Func<T1,T2>



      -abstract public class Func3
      +abstract public template Func<T1,T2>
        @@ -6494,7 +6617,13 @@

        Func3

      @@ -6510,27 +6639,9 @@

      Method Summary

      - - - - - - - - +abstract  T2 @@ -6539,20 +6650,20 @@

      Method Summary


      - +
      system'
      -

      Func4

      +

      Func<T1,T2,T3>



      -abstract public class Func4
      +abstract public template Func<T1,T2,T3>
      @@ -6577,27 +6694,9 @@

      Method Summary

      - - - - - - - - +abstract  T3 @@ -6606,20 +6705,20 @@

      Method Summary


      - +
      system'
      -

      Func5

      +

      Func<T1,T2,T3,T4>



      -abstract public class Func5
      +abstract public template Func<T1,T2,T3,T4>
      @@ -6644,27 +6749,9 @@

      Method Summary

      +abstract  T4 - - - - - - - - @@ -6673,20 +6760,20 @@

      Method Summary


      - +
      system'
      -

      Func6

      +

      Func<T1,T2,T3,T4,T5>



      -abstract public class Func6
      +abstract public template Func<T1,T2,T3,T4,T5>
      @@ -6711,27 +6804,64 @@

      Method Summary

      +abstract  T5 - - - +
      Modifier and TypeConstructor / Static Method
      - -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Enumerator en) +new() + +
      + +FormatException +new(String message)
      -function(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) +function()
      -run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Object param10, Enumerator en) +doWhile(b)
      -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Object param10, Enumerator en) +doUntil(b)
      -abstract   -function(param1, param2) - -
      - - -run(Object param, Enumerator en) - -
      - - -retrieve(Object param, Enumerator en) +function(T1 arg1, T1 arg2)
      -abstract   -function(param1, param2, param3) - -
      - - -run(Object param1, Object param2, Enumerator en) - -
      - - -retrieve(Object param1, Object param2, Enumerator en) +function(T1 arg)
      -abstract   -function(param1, param2, param3, param4) - -
      - - -run(Object param1, Object param2, Object param3, Enumerator en) - -
      - - -retrieve(Object param1, Object param2, Object param3, Enumerator en) +function(T1 arg1, T2 arg2)
      -abstract   -function(param1, param2, param3, param4, param5) - -
      - - -run(Object param1, Object param2, Object param3, Object param4, Enumerator en) - -
      - - -retrieve(Object param1, Object param2, Object param3, Object param4, Enumerator en) +function(T1 arg1, T2 arg2, T3 arg3)
      -abstract   -function(param1, param2, param3, param4, param5, param6) +function(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
      - - -run(Object param1, Object param2, Object param3, Object param4, Object param5, Enumerator en) - -
      +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    Func<T1,T2,T3,T4,T5,T6>

    +
    +
    +
    +
    +
    +
    +abstract public template Func<T1,T2,T3,T4,T5,T6>
    +
    +
    + + +
      +
    • +

      Method Summary

      + + + + +abstract  T6 @@ -6740,20 +6870,20 @@

      Method Summary


      - +
      system'
      -

      Func7

      +

      Func1



      -abstract public class Func7
      +abstract public class Func1
        @@ -6762,7 +6892,7 @@

        Func7

        • -system'Func7
        • +system'Func1
      @@ -6780,7 +6910,7 @@

      Method Summary

      abstract  
      @@ -6789,8 +6919,10 @@

      Method Summary

      @@ -6798,7 +6930,7 @@

      Method Summary

      @@ -6807,20 +6939,20 @@

      Method Summary


      - +
      system'
      -

      Func8

      +

      Func10



      -abstract public class Func8
      +abstract public class Func10
        @@ -6829,7 +6961,7 @@

        Func8

        • -system'Func8
        • +system'Func10
      @@ -6847,7 +6979,7 @@

      Method Summary

      abstract  
      @@ -6856,7 +6988,7 @@

      Method Summary

      @@ -6865,7 +6997,7 @@

      Method Summary

      @@ -6874,20 +7006,20 @@

      Method Summary


      - +
      system'
      -

      Func9

      +

      Func11



      -abstract public class Func9
      +abstract public class Func11
        @@ -6896,7 +7028,7 @@

        Func9

        • -system'Func9
        • +system'Func11
      @@ -6914,7 +7046,7 @@

      Method Summary

      abstract  
      @@ -6923,7 +7055,7 @@

      Method Summary

      @@ -6932,7 +7064,7 @@

      Method Summary

      @@ -6941,20 +7073,20 @@

      Method Summary


      - +
      system'
      -

      Handle

      +

      Func2



      -public class Handle
      +abstract public class Func2
        @@ -6963,95 +7095,43 @@

        Handle

        • -system'Handle
        • -
        -
      • +system'Func2
      - -
        -
      • -

        Field Summary

        -
      Modifier and TypeMethod
      - -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Enumerator en) +function(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
      -function(param1, param2, param3, param4, param5, param6, param7) +function(arg1)
      -run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Enumerator en) +run(Enumerator en) +
      +Executes the function for every enumeration item
      -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Enumerator en) +retrieve(Enumerator en)
      -function(param1, param2, param3, param4, param5, param6, param7, param8) +function(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)
      -run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Enumerator en) +run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Enumerator en)
      -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Enumerator en) +retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Enumerator en)
      -function(param1, param2, param3, param4, param5, param6, param7, param8, param9) +function(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11)
      -run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Enumerator en) +run(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Object param10, Enumerator en)
      -retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Enumerator en) +retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Object param6, Object param7, Object param8, Object param9, Object param10, Enumerator en)
      - - - - - - - - -
      Modifier and TypeField
      - - -_value -
    - +
    • -

      Constructor / Static Method Summary

      +

      Method Summary

      - + +abstract   + -
      Modifier and TypeConstructor / Static MethodMethod
      -Handle -constructor() +function(param1, param2)
      -Handle -constructor(UnsafePointer ptr) +run(Object param, Enumerator en)
      -
    • -
    - -
      -
    • -

      Static Property Summary

      - - - - - - - - - -
      Modifier and TypeStatic Property
      - -get  Handle -Default() -
      -
    • -
    - -
      -
    • -

      Method Summary

      - - - - - + @@ -7060,20 +7140,20 @@

      Method Summary


      - +
      system'
      -

      IConsoleReader

      +

      Func3



      -abstract public class IConsoleReader
      +abstract public class Func3
        @@ -7082,28 +7162,8 @@

        IConsoleReader

        • -system'IConsoleReader
        • -
        -
      • +system'Func3
      - -
        -
      • -

        Property Summary

        -
      Modifier and TypeMethod
      -BoolValue -isUnassigned() +retrieve(Object param, Enumerator en)
      - - - - - - - - -
      Modifier and TypeProperty
      - -get abstract  BoolValue -KeyAvailable() -
    @@ -7118,27 +7178,27 @@

    Method Summary

    -abstract  String +abstract  
    -readLine() +function(param1, param2, param3) -abstract  WideString + -readWideLine() +run(Object param1, Object param2, Enumerator en) -abstract  CharValue + -read() +retrieve(Object param1, Object param2, Enumerator en) @@ -7147,20 +7207,20 @@

    Method Summary


    - +
    system'
    -

    IConsoleWriter

    +

    Func4



    -abstract public class IConsoleWriter
    +abstract public class Func4
      @@ -7169,7 +7229,7 @@

      IConsoleWriter

      • -system'IConsoleWriter
      • +system'Func4
    @@ -7187,34 +7247,25 @@

    Method Summary

    abstract   -write(WideString s) +function(param1, param2, param3, param4) -abstract   + -write(String s) +run(Object param1, Object param2, Object param3, Enumerator en) -abstract   - -clear() - - - - - - -abstract   + -setCursorPosition(IntNumber x, IntNumber y) +retrieve(Object param1, Object param2, Object param3, Enumerator en) @@ -7223,20 +7274,20 @@

    Method Summary


    - +
    system'
    -

    Indexable

    +

    Func5



    -abstract public class Indexable
    +abstract public class Func5
      @@ -7245,7 +7296,7 @@

      Indexable

      • -system'Indexable
      • +system'Func5
    @@ -7261,9 +7312,27 @@

    Method Summary

    -abstract  Indexer +abstract  
    -indexer() +function(param1, param2, param3, param4, param5) + + + + + + + + +run(Object param1, Object param2, Object param3, Object param4, Enumerator en) + + + + + + + + +retrieve(Object param1, Object param2, Object param3, Object param4, Enumerator en) @@ -7272,20 +7341,20 @@

    Method Summary


    - +
    system'
    -

    Indexable<T1>

    +

    Func6



    -abstract public template Indexable<T1>
    +abstract public class Func6
      @@ -7294,7 +7363,7 @@

      Indexable<T1>

      • -system'Indexable<T1>
      • +system'Func6
    @@ -7310,9 +7379,27 @@

    Method Summary

    -abstract  Indexer<T1> +abstract  
    -indexer() +function(param1, param2, param3, param4, param5, param6) + + + + + + + + +run(Object param1, Object param2, Object param3, Object param4, Object param5, Enumerator en) + + + + + + + + +retrieve(Object param1, Object param2, Object param3, Object param4, Object param5, Enumerator en) @@ -7321,20 +7408,20 @@

    Method Summary


    - +
    system'
    -

    Indexer

    +

    Func7



    -abstract public class Indexer
    +abstract public class Func7
      @@ -7343,72 +7430,144 @@

      Indexer

      • -system'Indexer
      • +system'Func7
    - + +
    +
    + + + +
    +
    +system'
    +

    Func8

    +
    +
    +
    +
    +
    +
    +abstract public class Func8
    +
    +
    + + + +
    +
    + + + +
    +
    +system'
    +

    Func9

    +
    +
    +
    +
    +
    +
    +abstract public class Func9
    +
    +
    +
    - +
    system'
    -

    Indexer<T1>

    +

    Handle



    -abstract public template Indexer<T1>
    +public class Handle
      @@ -7454,87 +7631,84 @@

      Indexer<T1>

      • -system'Indexer<T1>
      • +system'Handle
    - +
    • -

      Property Summary

      +

      Field Summary

      - + + - - - +
      Modifier and TypePropertyField
      -get abstract  BoolValue -Available() +_value
      - -get abstract  T1 -Value() -
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + +Handle +Handle +Handle - - - -
      Modifier and TypeConstructor / Static Method
      -set abstract   -Value(T1 value) +loadDirty(IntNumber value)
      -get abstract  IntNumber -Index() +constructor() +
      -set abstract   -Index(IntNumber value) +constructor(UnsafePointer ptr)
      - -get abstract  IntNumber -Length() -
    - +
    • -

      Conversion Summary

      +

      Static Property Summary

      - + +get  Handle
      Modifier and TypeConversion MethodStatic Property
      -abstract  Indexer -cast() +Default()
      @@ -7552,9 +7726,9 @@

      Method Summary

      -abstract   +BoolValue
      -appendIndex(IntNumber index) +isUnassigned() @@ -7563,21 +7737,20 @@

      Method Summary


    - +
    system'
    -

    IntBaseNumber

    +

    IConsoleReader



    -abstract public class IntBaseNumber
    -a base integer value
    +abstract public class IConsoleReader
    @@ -7614,9 +7775,9 @@

    Property Summary

    -get abstract   +get abstract  BoolValue
    -BInverted() +KeyAvailable() @@ -7634,83 +7795,28 @@

    Method Summary

    -abstract   - -band(o) - -
    -Executes bitwise AND operation;
    should be overridden
    - - - - - -abstract   - -bor(o) - -
    -Executes bitwise OR operation;
    should be overridden
    - - - - - -abstract   - -bxor(o) - -
    -Executes bitwise XOR operation;
    should be overridden
    - - - - - - - -band(BaseVariable var) - - - - - - - +abstract  String
    -bor(BaseVariable var) +readLine() - +abstract  WideString -bxor(BaseVariable var) +readWideLine() -BoolValue - -allMask(operand) - -
    -Returns true if all the mask bits are set
    - - - - - -BoolValue +abstract  CharValue
    -anyMask(operand) +read() -
    -Returns true if any of the mask bits are set
    @@ -7718,20 +7824,20 @@

    Method Summary


    - +
    system'
    -

    intConvertor

    +

    IConsoleWriter



    -public singleton intConvertor
    +abstract public class IConsoleWriter
      @@ -7740,7 +7846,7 @@

      intConvertor

      • -system'intConvertor
      • +system'IConsoleWriter
    @@ -7756,117 +7862,45 @@

    Method Summary

    -IntNumber - -convert(o) - - - - - - -IntNumber - -convert(BaseVariable v) - - - - - - -IntNumber - -convert(IntNumber n) - - - - - - -IntNumber - -convert(ByteNumber b) - - - - - - -IntNumber - -convert(ShortNumber s) - - - - - - -IntNumber - -convert(UIntNumber n) - - - - - - -IntNumber - -convert(CharValue ch) - - - - - - -IntNumber - -convert(LongNumber l) - - - - - - -IntNumber +abstract  
    -convert(RealNumber r) +write(WideString s) -IntNumber +abstract   -convert(String s, IntNumber radix) +write(String s) -IntNumber +abstract   -convert(String s) +clear() -IntNumber +abstract   -convert(WideString s, IntNumber radix) +setCursorPosition(IntNumber x, IntNumber y) -IntNumber +abstract   -convert(WideString s) +refresh() @@ -7875,20 +7909,20 @@

    Method Summary


    - +
    system'
    -

    IntMatrix

    +

    Indexable



    -public class IntMatrix
    +abstract public class Indexable
      @@ -7897,67 +7931,108 @@

      IntMatrix

      • -system'IntMatrix
      • +system'Indexable
    - + - -
      -
    • -

      Constructor / Static Method Summary

      +
      +
    + + + +
    +
    +system'
    +

    Indexable<T1>

    +
    +
    +
    +
    +
    +
    +abstract public template Indexable<T1>
    +
    +
    + + + +
    +
    + + + +
    +
    +system'
    +

    Indexer

    +
    +
    +
    +
    +
    +
    +abstract public class Indexer
    +
    +
    +
    • @@ -7970,72 +8045,71 @@

      Property Summary

      -get  IntNumber +get abstract  BoolValue
      -Length() +Available() -get  IntNumber +get abstract   -Columns() +Value() -get  IntNumber +set abstract   -Rows() +Value(value) + - -
    • -
    - - + +
      +
    • +

      Method Summary

      + + + + + + +abstract   @@ -8044,21 +8118,20 @@

      Method Summary


      - +
      system'
      -

      IntNumber

      +

      Indexer<T1>



      -public class IntNumber
      -A signed 32 bit integer
      +abstract public template Indexer<T1>
      - +
      • -

        Field Summary

        +

        Property Summary

      Modifier and TypeMethod
      - -at(IntNumber i) +appendIndex(IntNumber index)
      - + +get abstract  BoolValue -
      Modifier and TypeFieldProperty
      -__int[4] -_value +Available()
      -
    • -
    - - - +
    • -

      Static Property Summary

      +

      Conversion Summary

      - - - - - - - - - + +abstract  Indexer
      Modifier and TypeStatic Property
      - -get  IntNumber -MinValue() -
      -Creates the object with the minimal value
      -
      - -get  IntNumber -MaxValue() -
      -Creates the object with the maximal value
      -
      Conversion Method
      -get  IntNumber -Default() +cast()
    - +
    • -

      Property Summary

      +

      Method Summary

      - + +abstract   - - - -
      Modifier and TypePropertyMethod
      -get  IntNumber -Negative() -
      - -get  IntNumber -BInverted() -
      -Bitwise inversion
      +appendIndex(IntNumber index) +
    +
    +
    + + + +
    +
    +system'
    +

    IntBaseNumber

    +
    +
    +
    +
    +
    +
    +abstract public class IntBaseNumber
    +a base integer value
    +
    +
    +
    • -

      Conversion Summary

      +

      Property Summary

      - - - - - - - - - - - - - - - - - + +get abstract  
      Modifier and TypeConversion Method
      - -ByteNumber -cast() -
      -Returns the byte value
      -
      - -ShortNumber -cast() -
      -Returns the value as a short integer
      -
      - -LongNumber -cast() -
      -Returns the long integer
      -
      - -RealNumber -cast() -
      -Returns the real number
      -
      Property
      -UIntNumber -cast() -
      -Returns the unsigned integer
      +BInverted()
      @@ -8314,28 +8320,34 @@

      Method Summary

      -BoolValue +abstract   -less(o) +band(o) +
      +Executes bitwise AND operation;
      should be overridden
      -BoolValue +abstract  
      -equal(o) +bor(o) +
      +Executes bitwise OR operation;
      should be overridden
      -String +abstract  
      -toPrintable() +bxor(o) +
      +Executes bitwise XOR operation;
      should be overridden
      @@ -8343,7 +8355,7 @@

      Method Summary

      -add(o) +band(BaseVariable var) @@ -8352,7 +8364,7 @@

      Method Summary

      -subtract(o) +bor(BaseVariable var) @@ -8361,172 +8373,855 @@

      Method Summary

      -multiply(o) +bxor(BaseVariable var) - +BoolValue -divide(o) +allMask(operand) +
      +Returns true if all the mask bits are set
      - +BoolValue
      -band(n) +anyMask(operand) +
      +Returns true if any of the mask bits are set
      + +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    intConvertor

    +
    +
    +
    +
    +
    +
    +public singleton intConvertor
    +
    +
    + + + +
    +
    + + + +
    +
    +system'
    +

    IntMatrix

    +
    +
    +
    +
    +
    +
    +public class IntMatrix
    +
    +
    + + + + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + + + + +
      Modifier and TypeConstructor / Static Method
      + +IntMatrix +allocate(IntNumber rows, IntNumber columns) + +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  IntNumber +Length() +
      + +get  IntNumber +Columns() +
      + +get  IntNumber +Rows() +
      +
    • +
    + + +
    +
    + + + +
    +
    +system'
    +

    IntNumber

    +
    +
    +
    +
    +
    +
    +public class IntNumber
    +A signed 32 bit integer
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + +__int[4] +_value +
      +
    • +
    + + + +
      +
    • +

      Static Property Summary

      + + + + + + + + + + + + + + + + + +
      Modifier and TypeStatic Property
      + +get  IntNumber +MinValue() +
      +Creates the object with the minimal value
      +
      + +get  IntNumber +MaxValue() +
      +Creates the object with the maximal value
      +
      + +get  IntNumber +Default() +
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + + + + + + + + + + +
      Modifier and TypeProperty
      + +get  IntNumber +Negative() +
      + +get  IntNumber +BInverted() +
      +Bitwise inversion
      +
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modifier and TypeConversion Method
      + +ByteNumber +cast() +
      +Returns the byte value
      +
      + +ShortNumber +cast() +
      +Returns the value as a short integer
      +
      + +LongNumber +cast() +
      +Returns the long integer
      +
      + +RealNumber +cast() +
      +Returns the real number
      +
      + +UIntNumber +cast() +
      +Returns the unsigned integer
      +
      +
    • +
    + + @@ -10459,6 +11170,22 @@

    Extension Summary

    +get property  IntNumber + +Hashcode() + + + + + +get property  LongNumber + +Absolute() + + + + + LongNumber power(LongNumber y) @@ -10573,6 +11300,22 @@

    Extension Summary

    + + + +get property  IntNumber + +High() + + + + + +get property  IntNumber + +Low() + + @@ -10591,7 +11334,8 @@

    Message



    -public class Message
    +public class Message
    +A message constant
      @@ -11452,6 +12196,8 @@

      Extension Summary

      equalReference(Object o) +
      +Returns true if the specified object instances are equal; otherwise, false.
      @@ -11499,10 +12245,34 @@

      Extension Summary

      + + +__getParentClass() + +
      +Returns the parent class
      + + + + + + + +__getParent() + +
      +Returns the parent of the specified class
      + + + + + BoolValue safeEqual(Object o) +
      +Returns true if the parameter is equal to the object or false. It does not raise an exception if the objects are not compatible
      @@ -11526,13 +12296,24 @@

      Extension Summary

      +BoolValue + +isNil() + +
      +Returns true if the object is nil
      + + + + + doWith(Object action) - + BoolValue @@ -11543,16 +12324,58 @@

      Extension Summary

      Checks if the object is an instance of type + + + +BoolValue + +subsetOf(Object type) + + + + + + +BoolValue + +isLiteral() + +
      +Returns true if the object is literal or character
      + + + + + +BoolValue + +isInteger() + +
      +Returns true if the object is an integer number
      + + +BoolValue + +isNumber() + +
      +Returns true if the object is a number
      + + + + + Array Subarray(IntNumber index, IntNumber length) - + @@ -11561,7 +12384,7 @@

      Extension Summary

      - + @@ -11570,7 +12393,7 @@

      Extension Summary

      - + @@ -11579,7 +12402,7 @@

      Extension Summary

      - + @@ -11588,7 +12411,7 @@

      Extension Summary

      - + @@ -11597,7 +12420,7 @@

      Extension Summary

      - + @@ -11606,7 +12429,7 @@

      Extension Summary

      - + @@ -11615,7 +12438,7 @@

      Extension Summary

      - + @@ -11624,7 +12447,7 @@

      Extension Summary

      - + @@ -13145,19 +13968,28 @@

      Extension Summary

      RealNumber -truncate(IntNumber precision) +round(IntNumber precision) +RealNumber + +truncate(IntNumber precision) + + + + + + get property  RealNumber Radian() - + get property  RealNumber @@ -13165,7 +13997,7 @@

      Extension Summary

      Degree() - + BoolValue @@ -13174,7 +14006,7 @@

      Extension Summary

      - + BoolValue @@ -13183,7 +14015,7 @@

      Extension Summary

      - + BoolValue @@ -13192,7 +14024,7 @@

      Extension Summary

      - + BoolValue @@ -15668,12 +16500,110 @@

      Constructor / Static Method Summary

      - + + + +StackOverflowException + +new(String message) + + + + + +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + +
      Modifier and TypeMethod
      + +String +toPrintable() + +
      +
    • +
    +
    + + + + +
    +
    +system'
    +

    StartUpEvents

    +
    +
    +
    +
    +
    +
    +public class StartUpEvents
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + + + + + +
      Modifier and TypeField
      + +Func +OnStop +
      + +Func1 +OnError +
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + +internal  StartUpEvents @@ -15692,9 +16622,18 @@

      Method Summary

      +internal   + + + + @@ -15768,13 +16707,22 @@

      Constructor / Static Method Summary

      + + + + - + @@ -15783,7 +16731,7 @@

      Constructor / Static Method Summary

      - + @@ -15792,7 +16740,7 @@

      Constructor / Static Method Summary

      - + @@ -15801,7 +16749,7 @@

      Constructor / Static Method Summary

      - + @@ -15810,7 +16758,7 @@

      Constructor / Static Method Summary

      - + @@ -15819,6 +16767,15 @@

      Constructor / Static Method Summary

      + + + +
      Modifier and TypeConstructor / Static Method
      -StackOverflowException -new(String message) +new()
      -String -toPrintable() +stopping() + +
      + +internal   +handlingError(e)
      + +dispatch() + +
      + String allocate(IntNumber size)
      String
      String
      String
      String
      internal  String
      + +String +arams:$#constructor(Object args) + +
    @@ -16327,6 +17284,15 @@

    Extension Summary

    + + + +String + +replaceFirst(String replacee, String replacer) + + + @@ -17876,85 +18842,299 @@

    Method Summary

    -UIntNumber +UIntNumber + +shiftRight(UIntNumber val) + + + + + + +UIntNumber + +shiftRight(IntNumber val) + + + + + + +UIntNumber + +clone() + + + + + + + + +
    +
    + + + +
    +
    +system'
    +

    UnsafePointer

    +
    +
    +
    +
    +
    +
    +public class UnsafePointer
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + + + + +
      Modifier and TypeField
      + + +_pointer +
      +
    • +
    + + - +
    • -

      Extension Summary

      +

      Static Property Summary

      - + +get  UnsafePointer - - - +
      Modifier and TypeExtension MethodStatic Property
      -UIntNumber -sqr() - +Default()
      - -UIntNumber -sqrt() - -
      +
    • +
    + + + + +
    +
    + + + +
    +
    +system'
    +

    ushortConvertor

    +
    +
    +
    +
    +
    +
    +public singleton ushortConvertor
    +
    +
    + + + + +
      +
    • +

      Static Property Summary

      + + + + + + + + + + + + + + +
      Modifier and TypeStatic Property
      + +get  UShortNumber +MinValue() +
      +Returns the minimal value (0)
      +
      + +get  UShortNumber +MaxValue() +
      +Returns the maxial value (65535)
      +
      + +get  UShortNumber -constructor(Object obj) - +Default()
    - +
    • -

      Static Property Summary

      +

      Property Summary

      - + +get  UShortNumber + + + +
      Modifier and TypeStatic PropertyProperty
      -get  UnsafePointer -Default() +Negative() +
      + +get  UShortNumber +BInverted() +
      +bitwise inversion
      @@ -18142,17 +19468,21 @@

      Conversion Summary

      -String +ByteNumber cast() +
      +Returns the byte value
      -WideString +ShortNumber cast() +
      +Returns the signed short value
      @@ -18161,6 +19491,38 @@

      Conversion Summary

      IntNumber cast() +
      +Returns the integer value
      + + + + + +UIntNumber + +cast() +
      +Returns the unsigned integer value
      + + + + + +LongNumber + +cast() +
      +Returns the long integer value
      + + + + + +RealNumber + +cast() +
      +Returns the real number value
      @@ -18180,176 +19542,89 @@

      Method Summary

      BoolValue -isUnassigned() +less(o) - +BoolValue -copyTo(system'ByteNumber[] target, IntNumber len) +equal(o) - -
    • -
    -
    -
    - - - -
    -
    -system'
    -

    ushortConvertor

    -
    -
    -
    -
    -
    -
    -public singleton ushortConvertor
    -
    -
    - - - -
    -
    - - - -
    -
    -system'
    -

    UShortNumber

    -
    -
    -
    -
    -
    -
    -public class UShortNumber
    -an unsigned 16 bit integer
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - + + + + + + + -
      Modifier and TypeField
      + + +subtract(o) + +
      + + +multiply(o) + +
      -_value +divide(o) +
      -
    • -
    - -
      -
    • -

      Constructor / Static Method Summary

      - - - - + + + + + @@ -18357,10 +19632,10 @@

      Constructor / Static Method Summary

      UShortNumber @@ -18368,10 +19643,10 @@

      Constructor / Static Method Summary

      UShortNumber @@ -18379,110 +19654,87 @@

      Constructor / Static Method Summary

      UShortNumber -
      Modifier and TypeConstructor / Static Method
      + + +band(n) + +
      -UShortNumber -constructor() +bor(n) -
      -creates the object with a default value (0)
      -UShortNumber -constructor(UShortNumber s) +bxor(n) -
      -creates the object with specified value
      -constructor(ShortNumber s) +add(UShortNumber n)
      -creates the object with specified value
      +returns the sum
      -constructor(ByteNumber b) +subtract(UShortNumber n)
      -creates the object with specified value
      +returns the difference
      -constructor(IntNumber n) +multiply(UShortNumber n) +
      +returns the product
      -
    • -
    - - - - - -
      -
    • -

      Conversion Summary

      - - - - - +IntNumber +IntNumber @@ -18490,19 +19742,21 @@

      Conversion Summary

      IntNumber +IntNumber @@ -18510,121 +19764,131 @@

      Conversion Summary

      LongNumber +LongNumber -
      Modifier and TypeConversion Method
      -ByteNumber -cast() +add(IntNumber n) +
      -Returns the byte value
      +returns the sum
      -ShortNumber -cast() +subtract(IntNumber n) +
      -Returns the signed short value
      +returns the difference
      -cast() +multiply(IntNumber n) +
      -Returns the integer value
      +returns the product
      -UIntNumber -cast() +divide(IntNumber n) +
      -Returns the unsigned integer value
      +returns the result of integer division
      -cast() +add(LongNumber n) +
      -Returns the long integer value
      +returns the sum
      -RealNumber -cast() +subtract(LongNumber n) +
      -Returns the real number value
      +returns the difference
      -
    • -
    - - +
    +
    + + + +
    +
    +system'
    +

    Variable

    +
    +
    +
    +
    +
    +
    +public class Variable
    +A generic variable.
    Extends an assigned value
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + + +Object +
      Modifier and TypeField
      -UShortNumber -bor(UShortNumber n) - -
      -Returns the result of bitwise OR operation
      +value
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + +Variable +Variable +
      Modifier and TypeConstructor / Static Method
      -UShortNumber -bxor(UShortNumber n) +constructor(value)
      -Returns the result of bitwise XOR operation
      +Creates the variable
      -UShortNumber -band(ByteNumber n) +constructor()
      -Returns the result of bitwise AND operation
      +Creates the empty variable
      +
    • +
    + +
      +
    • +

      Method Summary

      + + + + + + + + + +
      Modifier and TypeMethod
      -UShortNumber -bor(ByteNumber n) +append(val) -
      -Returns the result of bitwise OR operation
      -UShortNumber -bxor(ByteNumber n) +reduce(val) -
      -Returns the result of bitwise XOR operation
      -IntNumber -band(IntNumber n) +multiplyBy(val) -
      -Returns the result of bitwise AND operation
      -IntNumber -bor(IntNumber n) +divideBy(val) -
      -Returns the result of bitwise OR operation
      +
    • +
    +
    +
    + + + +
    +
    +system'
    +

    Variant

    +
    +
    +
    +
    +
    +
    +public class Variant
    +A basic type variant class
    +
    +
    + + +
      +
    • +

      Field Summary

      + + + + + +Object - +
      Modifier and TypeField
      -IntNumber -bxor(IntNumber n) - -
      -Returns the result of bitwise XOR operation
      +value
      +
    • +
    + +
      +
    • +

      Constructor / Static Method Summary

      + + + + + + +Variant +
      Modifier and TypeConstructor / Static Method
      -LongNumber -band(LongNumber n) +constructor(object) -
      -Returns the result of bitwise AND operation
      +
    • +
    + + + +
    - +
    system'
    -

    Variable

    +

    wideConvertor



    -public class Variable
    -A generic variable.
    Extends an assigned value
    +public singleton wideConvertor
      @@ -19150,112 +20507,115 @@

      Variable

    - +
    • -

      Field Summary

      +

      Method Summary

      - + +WideString -
      Modifier and TypeFieldMethod
      -Object -value +convert(o) +
      -
    • -
    - - - - - -
      -
    • -

      Constructor / Static Method Summary

      - - - - - - - +
      Modifier and TypeConstructor / Static Method
      - -Variant -constructor(object) - +array
      -
    • -
    - - - +
    • -

      Method Summary

      +

      Static Property Summary

      - + +get  WideString - - - +
      Modifier and TypeMethodStatic Property
      -BoolValue -equal(p) - +MinValue()
      - -String -toPrintable() - -
      +
    • +
    + +
      +
    • +

      Property Summary

      + + + + +get  IntNumber - - - +
      Modifier and TypeProperty
      - -saveTo(target) - +Length()
      - - -add(p) - -
      +
    • +
    + +
      +
    • +

      Conversion Summary

      + + + + +String - - - - +Enumerable<system'CharValue>
      Modifier and TypeConversion Method
      - -subtract(p) - +cast()
      - -multiply(p) - -
      - - -divide(p) - +cast()
    -
    -
    - - - -
    -
    -system'
    -

    wideConvertor

    -
    -
    -
    -
    -
    -
    -public singleton wideConvertor
    -
    -
    -
    -
    -
    - - - -
    -
    -system'
    -

    WideString

    -
    -
    -
    -
    -
    -
    -public class WideString
    -
    -
    - - -
      -
    • -

      Field Summary

      - - - - + + + +IntNumber -
      Modifier and TypeField
      + +WideString +add(WideString subs) + +
      +Concatinates the values
      +
      - -array +indexOf(IntNumber index, WideString literal) + +
      +Saves the index of the first occurence of the specified substring into an output parameter.
      If the substring is not found. returns -1
      -
    • -
    - - - - - - - - - +

    + + + +
    +
    +system'
    +

    EmptyString

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public  String +EmptyString +
      +
    • +
    +
    +
    +
    @@ -20265,13 +21503,13 @@

    Symbol Summary


    - +
    system'
    -

    newLineConstant

    +

    NewLineConstant

    @@ -20294,7 +21532,7 @@

    Symbol Summary

    public  String -newLineConstant +NewLineConstant @@ -20339,6 +21577,43 @@

    Symbol Summary


    + + + +
    +
    +system'
    +

    startUpEvents

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
      +
    • +

      Symbol Summary

      + + + + + + + +
      Modifier and TypeName
      + +public  StartUpEvents +startUpEvents +
      +
    • +
    +
    +
    +
    @@ -20387,7 +21662,7 @@

    Symbol Summary

    -ELENA Standard Library
    6.0 +ELENA Standard Library
    6.3
    diff --git a/doc/tech/bytecode60.txt b/doc/tech/bytecode60.txt index d77d8821fe..295e35599f 100644 --- a/doc/tech/bytecode60.txt +++ b/doc/tech/bytecode60.txt @@ -165,10 +165,10 @@ ELENA byte codes (or ecodes) jump vt:i - jump to acc::VMT[i] method; acc contains the result - vcall mssg:m, r - calls via table the method resolved by JIT by r and m + vcall mssg:m, r - calls via table (or index table in alt mode) the method resolved by JIT by r and m acc contains the result - vjump mssg:m, r - jumps via table the method resolved by JIT by r and m + vjump mssg:m, r - jumps via table (or index table in alt mode) the method resolved by JIT by r and m acc contains the result xcall - calls the procedure in acc; @@ -280,7 +280,7 @@ ELENA byte codes (or ecodes) temp >> dp[disp]; dispatch m, r - search in message table r the message in index and provided parameter list; - if found jumps to it; + if found jumps to it / index table (in alt mode); dtrans - sp[0] >> acc, index ptrs @@ -320,7 +320,7 @@ ELENA byte codes (or ecodes) temp >> acc[disp]; xdispatch i - index - message, acc[i], acc[i+1], ... - list of overload list, null terminated; - searches in overload list for mathced signature, if found jumps to direct address; + searches in overload list for mathced signature, if found jumps directly to it; otherwise goes to the next one, until zero is encountered xdispatch m, r - search in message table r the message in index and provided parameter list; @@ -506,6 +506,8 @@ ELENA byte codes (or ecodes) Misc operations: ---------------- + altmode - turn on alt mode; after the affected operation, it is reset + freelock - free acc label dp:i, r - assign a specified address / label to dp[i] diff --git a/doc/todo.txt b/doc/todo.txt index 62a29bbfb6..e2cdb16077 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -3,39 +3,40 @@ In development: ------ [development] - ### EPIC: elena 6.4 ### + ### EPIC: elena 6.5 ### - === Iteration 33 (7.10) === + === Iteration 34 === -------------------------------------- dev: - - async programming - upndown (connector) - #496 - - Func must have default conversion to Func? - toArray extension method (parameterized method extensions) - - retest : #25, #412, #413, #414 + - #676 + - #622 (http client) gen: - lpad : generate a code based on a record maint: - - #675 - #689 - unit tests : bt optimization - - fix warnings in all libraries + - test binary file operations + - test encoders with files + - api refactoring : all symbols must start with a capital letter + - redesign winforms + - api : add descriptions port: + tools: - #658 : connect with ldbg from VSCode prom: posting weekly -------------------------------------- - * #676 - * x86-64 : mta - corex - * ldoc : system'collections'threadsafe : only proper templates must be shown - * Task - * ldoc : system-threading-.html must not be generated - * async statemachine - * $await operator - -------------------------------------- - * async method must create an enumerator and call a static method proceed + * x86-64 : mta - main sample sandbox2 + * forms : review warnings + * test all examples : db + -------------------------------------- + * fix x86-64 : mta - sandbox2 - === Iteration 34 === + ### EPIC: elena 6.6 ### + + === Iteration 35 === -------------------------------------- dev: gen: @@ -45,9 +46,7 @@ In development: -------------------------------------- -------------------------------------- - ### EPIC: elena 6.5 ### - - === Iteration 35 === + === Iteration 36 === -------------------------------------- dev: gen: diff --git a/elenasrc3/elc/clicommon.h b/elenasrc3/elc/clicommon.h index 85839bcf62..65ea1e9411 100644 --- a/elenasrc3/elc/clicommon.h +++ b/elenasrc3/elc/clicommon.h @@ -194,9 +194,10 @@ struct BuiltinReferences ref_t nullableTemplateReference; ref_t argArrayTemplateReference; ref_t closureTemplateReference, tupleTemplateReference; - ref_t yielditTemplateReference; + ref_t yielditTemplateReference, asyncStatemachineReference; ref_t lazyExpressionReference; ref_t pointerReference; + ref_t taskReference; mssg_t dispatch_message; mssg_t constructor_message; @@ -231,8 +232,8 @@ struct BuiltinReferences arrayTemplateReference = argArrayTemplateReference = 0; nullableTemplateReference = 0; closureTemplateReference = lazyExpressionReference = tupleTemplateReference = 0; - yielditTemplateReference = 0; - pointerReference = 0; + asyncStatemachineReference = yielditTemplateReference = 0; + taskReference = pointerReference = 0; dispatch_message = constructor_message = 0; protected_constructor_message = 0; @@ -319,19 +320,6 @@ class ModuleScopeBase : public SectionScopeBase virtual bool isDeclared(ref_t reference) = 0; virtual bool isSymbolDeclared(ref_t reference) = 0; - virtual bool isInternalOp(ref_t reference) - { - ustr_t referenceName = resolveFullName(reference); - if (isWeakReference(referenceName)) { - return true; - } - else { - auto refInfo = getModule(referenceName, true); - - return refInfo.module == module; - } - } - virtual ref_t mapAnonymous(ustr_t prefix = nullptr) = 0; virtual ref_t mapFullReference(ustr_t referenceName, bool existing = false) = 0; @@ -789,8 +777,8 @@ enum class VirtualType : int { None = 0, Multimethod, - EmbeddableWrapper, - AbstractEmbeddableWrapper + ByRefHandler, + AbstractByRefHandler }; struct VirtualMethod diff --git a/elenasrc3/elc/cliconst.h b/elenasrc3/elc/cliconst.h index 6230134592..78e78838fd 100644 --- a/elenasrc3/elc/cliconst.h +++ b/elenasrc3/elc/cliconst.h @@ -13,7 +13,7 @@ namespace elena_lang { - #define ELC_REVISION_NUMBER 0x0046 + #define ELC_REVISION_NUMBER 0x005B #if defined _M_IX86 || _M_X64 diff --git a/elenasrc3/elc/compiler.cpp b/elenasrc3/elc/compiler.cpp index 26056dba18..aaf1942b3d 100644 --- a/elenasrc3/elc/compiler.cpp +++ b/elenasrc3/elc/compiler.cpp @@ -116,6 +116,12 @@ inline bool validateGenericClosure(ref_t* signature, size_t length) inline ref_t mapAsWeakReference(ModuleScopeBase* scope, ref_t reference) { ustr_t refName = scope->module->resolveReference(reference); + +#ifndef NDEBUG + // make sure that only real template based classes are mapped + assert(refName.find('#') != NOTFOUND_POS); +#endif // _DEBUG + if (!isWeakReference(refName)) { size_t index = refName.findLast('\'', 0); @@ -511,43 +517,43 @@ ObjectInfo Interpreter::createConstCollection(ref_t arrayRef, ref_t typeRef, Arg for (size_t i = 0; i < args.count(); i++) { auto arg = args[i]; switch (arg.kind) { - case ObjectKind::StringLiteral: - addConstArrayItem(arrayRef, arg.reference, mskLiteralRef); - break; - case ObjectKind::IntLiteral: - if (byValue) { - addIntArrayItem(arrayRef, arg.extra); - } - else addConstArrayItem(arrayRef, arg.reference, mskIntLiteralRef); - break; - case ObjectKind::LongLiteral: - if (byValue) { - ustr_t valStr = _scope->module->resolveConstant(arg.reference); - long long val = StrConvertor::toLong(valStr, 16); + case ObjectKind::StringLiteral: + addConstArrayItem(arrayRef, arg.reference, mskLiteralRef); + break; + case ObjectKind::IntLiteral: + if (byValue) { + addIntArrayItem(arrayRef, arg.extra); + } + else addConstArrayItem(arrayRef, arg.reference, mskIntLiteralRef); + break; + case ObjectKind::LongLiteral: + if (byValue) { + ustr_t valStr = _scope->module->resolveConstant(arg.reference); + long long val = StrConvertor::toLong(valStr, 16); - addLongArrayItem(arrayRef, val); - } - else addConstArrayItem(arrayRef, arg.reference, mskLongLiteralRef); - break; - case ObjectKind::Float64Literal: - if (byValue) { - ustr_t valStr = _scope->module->resolveConstant(arg.reference); - double val = StrConvertor::toDouble(valStr); + addLongArrayItem(arrayRef, val); + } + else addConstArrayItem(arrayRef, arg.reference, mskLongLiteralRef); + break; + case ObjectKind::Float64Literal: + if (byValue) { + ustr_t valStr = _scope->module->resolveConstant(arg.reference); + double val = StrConvertor::toDouble(valStr); - addFloatArrayItem(arrayRef, val); - } - else addConstArrayItem(arrayRef, arg.reference, mskRealLiteralRef); - break; - case ObjectKind::Singleton: - case ObjectKind::Class: - addConstArrayItem(arrayRef, arg.reference, mskVMTRef); - break; - case ObjectKind::MssgNameLiteral: - addMssgNameArrayItem(arrayRef, arg.reference); - break; - default: - assert(false); - break; + addFloatArrayItem(arrayRef, val); + } + else addConstArrayItem(arrayRef, arg.reference, mskRealLiteralRef); + break; + case ObjectKind::Singleton: + case ObjectKind::Class: + addConstArrayItem(arrayRef, arg.reference, mskVMTRef); + break; + case ObjectKind::MssgNameLiteral: + addMssgNameArrayItem(arrayRef, arg.reference); + break; + default: + assert(false); + break; } } @@ -565,15 +571,15 @@ bool Interpreter::evalObjArrayOp(ref_t operator_id, ArgumentsInfo& args) if (loperand.kind == ObjectKind::TypeList) { ref_t mask = 0; switch (roperand.kind) { - case ObjectKind::Symbol: - mask = mskSymbolRef; - break; - case ObjectKind::Singleton: - case ObjectKind::Class: - mask = mskVMTRef; - break; - default: - break; + case ObjectKind::Symbol: + mask = mskSymbolRef; + break; + case ObjectKind::Singleton: + case ObjectKind::Class: + mask = mskVMTRef; + break; + default: + break; } if (mask != 0) { addTypeListItem(loperand.reference, roperand.reference, mask); @@ -591,89 +597,89 @@ bool Interpreter::evalIntOp(ref_t operator_id, ArgumentsInfo& args, ObjectInfo& ObjectInfo roperand = args[1]; switch (operator_id) { - case ADD_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra + roperand.extra; + case ADD_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra + roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case SUB_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra - roperand.extra; + return true; + } + break; + case SUB_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra - roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case MUL_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra * roperand.extra; + return true; + } + break; + case MUL_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra * roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case DIV_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra / roperand.extra; + return true; + } + break; + case DIV_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra / roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case BAND_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra & roperand.extra; + return true; + } + break; + case BAND_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra & roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case BOR_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra | roperand.extra; + return true; + } + break; + case BOR_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra | roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case BXOR_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra ^ roperand.extra; + return true; + } + break; + case BXOR_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra ^ roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case SHL_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra << roperand.extra; + return true; + } + break; + case SHL_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra << roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - case SHR_OPERATOR_ID: - if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { - int value = loperand.extra >> roperand.extra; + return true; + } + break; + case SHR_OPERATOR_ID: + if (loperand.kind == ObjectKind::IntLiteral && roperand.kind == ObjectKind::IntLiteral) { + int value = loperand.extra >> roperand.extra; - retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; + retVal = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(_scope, value), value }; - return true; - } - break; - default: - break; + return true; + } + break; + default: + break; } return false; } @@ -697,20 +703,20 @@ bool Interpreter::evalRealOp(ref_t operator_id, ArgumentsInfo& args, ObjectInfo& double result = 0; switch (operator_id) { - case ADD_OPERATOR_ID: - result = lvalue + rvalue; - break; - case SUB_OPERATOR_ID: - result = lvalue - rvalue; - break; - case MUL_OPERATOR_ID: - result = lvalue * rvalue; - break; - case DIV_OPERATOR_ID: - result = lvalue / rvalue; - break; - default: - return false; + case ADD_OPERATOR_ID: + result = lvalue + rvalue; + break; + case SUB_OPERATOR_ID: + result = lvalue - rvalue; + break; + case MUL_OPERATOR_ID: + result = lvalue * rvalue; + break; + case DIV_OPERATOR_ID: + result = lvalue / rvalue; + break; + default: + return false; } retVal = { ObjectKind::Float64Literal, { V_FLOAT64 }, ::mapFloat64Const(_scope->module, result) }; @@ -1347,12 +1353,7 @@ Compiler::MethodScope::MethodScope(ClassScope* parent) : bool Compiler::MethodScope::checkType(MethodHint type) { - return (info.hints & MethodHint::Mask) == type; -} - -bool Compiler::MethodScope::checkType(MethodInfo& methodInfo, MethodHint type) -{ - return (methodInfo.hints & MethodHint::Mask) == type; + return MethodInfo::checkType(info, type); } ObjectInfo Compiler::MethodScope :: mapSelf(bool memberMode, bool ownerClass) @@ -1855,8 +1856,8 @@ bool Compiler::InlineClassScope::markAsPresaved(ObjectInfo object) // --- Compiler::StatemachineClassScope --- -Compiler::StatemachineClassScope::StatemachineClassScope(ExprScope* owner, ref_t reference) - : InlineClassScope(owner, reference), contextSize(0), typeRef(0) +Compiler::StatemachineClassScope::StatemachineClassScope(ExprScope* owner, ref_t reference, bool asyncMode) + : InlineClassScope(owner, reference), contextSize(0), typeRef(0), resultRef(0), asyncMode(asyncMode) { } @@ -2335,7 +2336,7 @@ void Compiler :: declareVMT(ClassScope& scope, SyntaxNode node, bool& withConstr if (!current.arg.reference) { // NOTE : an extension method must be strong-resolved declareVMTMessage(methodScope, current, - methodScope.checkHint(MethodHint::Extension), true); + methodScope.checkHint(MethodHint::Extension), true, templateBased); current.setArgumentReference(methodScope.message); } @@ -2349,8 +2350,8 @@ void Compiler :: declareVMT(ClassScope& scope, SyntaxNode node, bool& withConstr if ((methodScope.message & ~STATIC_MESSAGE) == scope.moduleScope->buildins.constructor_message) { withDefaultConstructor = true; } - else if (getArgCount(methodScope.message) == 0 && (methodScope.checkHint(MethodHint::Protected) - || methodScope.checkHint(MethodHint::Internal))) + else if (getArgCount(methodScope.message) == 0 && (MethodInfo::checkVisibility(methodScope.info, MethodHint::Protected) + || MethodInfo::checkVisibility(methodScope.info, MethodHint::Internal))) { // check if it is protected / iternal default constructor ref_t dummy = 0; @@ -2394,7 +2395,7 @@ void Compiler::loadMetaData(ModuleScopeBase* moduleScope, ForwardResolverBase* f } } -Compiler::InheritResult Compiler::inheritClass(ClassScope& scope, ref_t parentRef, bool ignoreSealed) +Compiler::InheritResult Compiler :: inheritClass(ClassScope& scope, ref_t parentRef, bool ignoreSealed) { ref_t flagCopy = scope.info.header.flags; ref_t classClassCopy = scope.info.header.classRef; @@ -2421,16 +2422,15 @@ Compiler::InheritResult Compiler::inheritClass(ClassScope& scope, ref_t parentRe auto it = scope.info.methods.start(); while (!it.eof()) { mssg_t message = it.key(); - - ref_t hints = (*it).hints; + MethodInfo mi = *it; (*it).inherited = true; ++it; // private methods are not inherited - // except for the initializer - if (test(message, STATIC_MESSAGE) && !test(hints, (ref_t)MethodHint::Initializer)) + if (MethodInfo::checkVisibility(mi, MethodHint::Private)) { scope.info.methods.exclude(message); + } } } @@ -2590,7 +2590,7 @@ void Compiler::addTypeInfo(Scope& scope, SyntaxNode node, SyntaxKey key, TypeInf info.appendChild(SyntaxKey::Attribute, V_NILLABLE); } -void Compiler::generateMethodAttributes(ClassScope& scope, SyntaxNode node, +void Compiler :: generateMethodAttributes(ClassScope& scope, SyntaxNode node, MethodInfo& methodInfo, bool abstractBased) { mssg_t message = node.arg.reference; @@ -2623,10 +2623,10 @@ void Compiler::generateMethodAttributes(ClassScope& scope, SyntaxNode node, methodInfo.nillableArgs = node.findChild(SyntaxKey::NillableInfo).arg.reference; // check duplicates with different visibility scope - if (MethodScope::checkHint(methodInfo, MethodHint::Private)) { + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Private)) { checkMethodDuplicates(scope, node, message, message & ~STATIC_MESSAGE, false, false); } - else if (MethodScope::checkAnyHint(methodInfo, MethodHint::Protected, MethodHint::Internal)) { + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Protected, MethodHint::Internal)) { // if it is internal / protected message save the public alias ref_t signRef = 0; ustr_t name = scope.module->resolveAction(getAction(message), signRef); @@ -2641,9 +2641,10 @@ void Compiler::generateMethodAttributes(ClassScope& scope, SyntaxNode node, scope.raiseError(errDupInternalMethod, node); publicMessage = overwriteAction(message, scope.module->mapAction(name + index + 2, signRef, false)); + publicMessage &= ~STATIC_MESSAGE; } - if (MethodScope::checkHint(methodInfo, MethodHint::Protected)) { + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Protected)) { checkMethodDuplicates(scope, node, message, publicMessage, true, false); scope.addMssgAttribute(publicMessage, ClassAttribute::ProtectedAlias, message); @@ -2751,14 +2752,15 @@ void Compiler :: generateMethodDeclaration(ClassScope& scope, SyntaxNode node, b if (_withMethodParamInfo) generateParamNameInfo(scope, node, message); - bool privateOne = MethodScope::checkAnyHint(methodInfo, MethodHint::Private, MethodHint::Initializer); - bool internalOne = MethodScope::checkHint(methodInfo, MethodHint::Internal); + bool privateOne = MethodInfo::checkVisibility(methodInfo, MethodHint::Private) || MethodScope::checkHint(methodInfo, MethodHint::Initializer); + bool internalOne = MethodInfo::checkVisibility(methodInfo, MethodHint::Internal); + bool hiddenOne = internalOne && MethodScope::checkHint(methodInfo, MethodHint::Indexed); bool autoMultimethod = SyntaxTree::ifChildExists(node, SyntaxKey::Autogenerated, -1); bool predefined = MethodScope::checkHint(methodInfo, MethodHint::Predefined); // if the class is closed, no new methods can be declared // except private sealed ones (which are declared outside the class VMT) - if (!existing && closed && !privateOne && !predefined) { + if (!existing && closed && !privateOne && !predefined && !hiddenOne) { IdentifierString messageName; ByteCodeUtil::resolveMessageName(messageName, scope.module, message); @@ -2768,7 +2770,7 @@ void Compiler :: generateMethodDeclaration(ClassScope& scope, SyntaxNode node, b } // HOTFIX : auto generated sealed static methods should be allowed - if (existing && MethodScope::checkType(methodInfo, MethodHint::Sealed) && !autoMultimethod) + if (existing && MethodInfo::checkType(methodInfo, MethodHint::Sealed) && !autoMultimethod) scope.raiseError(errClosedMethod, node); if (test(scope.info.header.flags, elExtension) && (privateOne || internalOne)) @@ -2881,13 +2883,13 @@ void Compiler::injectVirtualMultimethod(SyntaxNode classNode, SyntaxKey methodTy if (!found || methodInfo.inherited) { Visibility visibility = Visibility::Public; - if (MethodScope::checkHint(methodInfo, MethodHint::Internal)) { + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Internal)) { visibility = Visibility::Internal; } - else if (MethodScope::checkHint(methodInfo, MethodHint::Protected)) { + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Protected)) { visibility = Visibility::Protected; } - else if (MethodScope::checkHint(methodInfo, MethodHint::Private)) { + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Private)) { visibility = Visibility::Private; } @@ -2909,29 +2911,88 @@ void Compiler::injectVirtualMultimethod(SyntaxNode classNode, SyntaxKey methodTy } } -void Compiler::injectVirtualMethods(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, +void Compiler :: injectVirtualMethods(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, ref_t targetRef, ClassInfo& info, VirtualMethodList& implicitMultimethods) { // generate implicit mutli methods for (auto it = implicitMultimethods.start(); !it.eof(); ++it) { auto methodInfo = *it; switch (methodInfo.type) { - case VirtualType::Multimethod: - injectVirtualMultimethod(classNode, methodType, scope, targetRef, info, methodInfo.message, methodInfo.nillableArgs); - break; - case VirtualType::EmbeddableWrapper: - injectVirtualEmbeddableWrapper(classNode, methodType, targetRef, info, methodInfo.message, false); - break; - case VirtualType::AbstractEmbeddableWrapper: - injectVirtualEmbeddableWrapper(classNode, methodType, targetRef, info, methodInfo.message, true); - break; - default: - break; + case VirtualType::Multimethod: + injectVirtualMultimethod(classNode, methodType, scope, targetRef, info, methodInfo.message, methodInfo.nillableArgs); + break; + default: + break; + } + } +} + +void Compiler :: declareVirtualMethods(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, + ref_t targetRef, ClassInfo& info, VirtualMethodList& implicitMultimethods) +{ + // generate implicit mutli methods + for (auto it = implicitMultimethods.start(); !it.eof(); ++it) { + auto methodInfo = *it; + switch (methodInfo.type) { + case VirtualType::ByRefHandler: + declareByRefHandler(classNode, methodType, targetRef, info, methodInfo.message, false); + break; + case VirtualType::AbstractByRefHandler: + declareByRefHandler(classNode, methodType, targetRef, info, methodInfo.message, true); + break; + default: + break; + } + } +} + +void Compiler :: declareByRefHandler(SyntaxNode classNode, SyntaxKey methodType, + ref_t targetRef, ClassInfo& info, mssg_t message, bool abstractOne) +{ + MethodInfo methodInfo = info.methods.get(message); + + assert(methodInfo.byRefHandler != 0); + + MethodInfo handlerInfo = {}; + auto m_it = info.methods.getIt(methodInfo.byRefHandler); + bool found = !m_it.eof(); + if (found) + handlerInfo = *m_it; + + handlerInfo.hints &= ~(ref_t)MethodHint::Mask; + handlerInfo.hints |= (ref_t)MethodHint::Autogenerated; + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Private)) { + handlerInfo.hints |= (ref_t)MethodHint::Private; + handlerInfo.hints |= (ref_t)MethodHint::Sealed; + } + else { + handlerInfo.hints |= (ref_t)MethodHint::Indexed; + handlerInfo.hints |= (ref_t)MethodHint::Normal; + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Protected)) { + handlerInfo.hints |= (ref_t)MethodHint::Protected; } + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Internal)) { + handlerInfo.hints |= (ref_t)MethodHint::Internal; + } + } + + if (abstractOne) { + handlerInfo.hints |= (ref_t)MethodHint::Abstract; + } + else handlerInfo.hints &= ~(ref_t)MethodHint::Abstract; + + // HOTFIX : mark it as stacksafe if required + if (_logic->isEmbeddableStruct(info)) + handlerInfo.hints |= (ref_t)MethodHint::Stacksafe; + + if (found) { + auto it = info.methods.getIt(methodInfo.byRefHandler); + (*it).hints = handlerInfo.hints; } + else info.methods.add(methodInfo.byRefHandler, handlerInfo); } -mssg_t Compiler::defineOutRefMethod(ClassScope& scope, SyntaxNode node, bool isExtension) +mssg_t Compiler :: defineOutRefMethod(ClassScope& scope, SyntaxNode node, bool isExtension) { TypeInfo outputTypeInfo = retrieveTypeInfo(node.findChild(SyntaxKey::OutputInfo)); // NOTE : the embedable type should be read-only, otherwise it is possible that the changes will be lost @@ -2943,7 +3004,9 @@ mssg_t Compiler::defineOutRefMethod(ClassScope& scope, SyntaxNode node, bool isE size_t argDiff = isExtension ? 0 : 1; ref_t signRef = 0; - ustr_t actionName = scope.module->resolveAction(actionRef, signRef); + IdentifierString actionName(scope.module->resolveAction(actionRef, signRef)); + actionName.append(BYREF_POSTFIX); + ref_t signArgs[ARG_COUNT]; size_t signLen = scope.module->resolveSignature(signRef, signArgs); if (signLen == (size_t)argCount - argDiff) { @@ -2951,7 +3014,7 @@ mssg_t Compiler::defineOutRefMethod(ClassScope& scope, SyntaxNode node, bool isE mssg_t byRefMessage = encodeMessage( scope.module->mapAction( - actionName, scope.module->mapSignature(signArgs, signLen, false), false), argCount + 1, flags); + *actionName, scope.module->mapSignature(signArgs, signLen, false), false), argCount + 1, flags | STATIC_MESSAGE); return byRefMessage; } @@ -2975,7 +3038,7 @@ void Compiler::verifyMultimethods(Scope& scope, SyntaxNode node, SyntaxKey metho } } -void Compiler::generateMethodDeclarations(ClassScope& scope, SyntaxNode node, SyntaxKey methodKey, bool closed) +void Compiler :: generateMethodDeclarations(ClassScope& scope, SyntaxNode node, SyntaxKey methodKey, bool closed) { VirtualMethodList implicitMultimethods({}); bool thirdPassRequired = false; @@ -3000,6 +3063,8 @@ void Compiler::generateMethodDeclarations(ClassScope& scope, SyntaxNode node, Sy hints |= (ref_t)MethodHint::Static; if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_PRIVATE)) hints |= (ref_t)MethodHint::Private; + if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_INDEXED_ATTR)) + hints |= (ref_t)MethodHint::Indexed; // mark weak message as a multi-method auto m_it = scope.info.methods.getIt(multiMethod); @@ -3035,18 +3100,14 @@ void Compiler::generateMethodDeclarations(ClassScope& scope, SyntaxNode node, Sy 0 : defineOutRefMethod(scope, current, scope.extensionClassRef != 0); if (byRefMethod) { - current.appendChild(SyntaxKey::ByRefRetMethod, byRefMethod); - - // HOTFIX : do not need to generate byref stub for the private method, it will be added later in the code // HOTFIX : ignore the redirect method - if ((!test(current.arg.reference, STATIC_MESSAGE) && !current.existChild(SyntaxKey::Redirect)) - && retrieveMethod(implicitMultimethods, byRefMethod) == 0) + if (!current.existChild(SyntaxKey::Redirect) && retrieveMethod(implicitMultimethods, byRefMethod) == 0) { + current.appendChild(SyntaxKey::ByRefRetMethod, byRefMethod); if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_ABSTRACT)) { - implicitMultimethods.add({ byRefMethod, VirtualType::AbstractEmbeddableWrapper, 0 }); + implicitMultimethods.add({ current.arg.reference, VirtualType::AbstractByRefHandler, 0 }); } - else implicitMultimethods.add({ byRefMethod, VirtualType::EmbeddableWrapper, 0 }); - thirdPassRequired = true; + else implicitMultimethods.add({ current.arg.reference, VirtualType::ByRefHandler, 0 }); } } } @@ -3084,6 +3145,11 @@ void Compiler::generateMethodDeclarations(ClassScope& scope, SyntaxNode node, Sy } } + //COMPILER MAGIC : if byref handler is declared - the compiler must declare the virtual multi method + if (implicitMultimethods.count() > 0) { + declareVirtualMethods(node, methodKey, scope, scope.reference, scope.info, implicitMultimethods); + } + if (implicitMultimethods.count() > 0) verifyMultimethods(scope, node, methodKey, scope.info, implicitMultimethods); } @@ -3441,6 +3507,8 @@ void Compiler::declareClassParent(ref_t parentRef, ClassScope& scope, SyntaxNode } else if (res == InheritResult::irUnsuccessfull) scope.raiseError(errUnknownBaseClass, baseNode); + + scope.info.header.flags &= ~elTemplatebased; // reset the flag by inheriting a template based class } void Compiler::importCode(Scope& scope, SyntaxNode node, SyntaxNode& importNode) @@ -3675,7 +3743,7 @@ void Compiler::declareParameter(MethodScope& scope, SyntaxNode current, bool wit nillable |= paramTypeInfo.nillable; } -void Compiler::declareVMTMessage(MethodScope& scope, SyntaxNode node, bool withoutWeakMessages, bool declarationMode) +void Compiler :: declareVMTMessage(MethodScope& scope, SyntaxNode node, bool withoutWeakMessages, bool declarationMode, bool templateBasedMode) { IdentifierString actionStr; ref_t actionRef = 0; @@ -3814,6 +3882,10 @@ void Compiler::declareVMTMessage(MethodScope& scope, SyntaxNode node, bool witho actionStr.copy(CONSTRUCTOR_MESSAGE); unnamedMessage = false; flags |= FUNCTION_MESSAGE; + + if (MethodInfo::checkVisibility(scope.info, MethodHint::Internal)) + scope.raiseError(errIllegalConstructor, node); + } else if (scope.checkHint(MethodHint::Generic) && scope.checkHint(MethodHint::Generic)) { if (signatureLen > 0 || !unnamedMessage || scope.checkHint(MethodHint::Function)) @@ -3842,6 +3914,10 @@ void Compiler::declareVMTMessage(MethodScope& scope, SyntaxNode node, bool witho } } + if (scope.checkHint(MethodHint::Internal) && scope.checkHint(MethodHint::Indexed)) { + flags |= STATIC_MESSAGE; + } + if (scope.checkHint(MethodHint::GetAccessor) || scope.checkHint(MethodHint::SetAccessor)) { flags |= PROPERTY_MESSAGE; } @@ -3870,11 +3946,17 @@ void Compiler::declareVMTMessage(MethodScope& scope, SyntaxNode node, bool witho scope.info.hints |= (ref_t)MethodHint::VirtualReturn; } - if (scope.checkHint(MethodHint::Internal)) { + if (MethodInfo::checkVisibility(scope.info, MethodHint::Internal)) { actionStr.insert("$$", 0); - actionStr.insert(scope.module->name(), 0); + if (templateBasedMode) { + ReferenceProperName ns; + _logic->retrieveTemplateNs(*scope.moduleScope, scope.getClassRef(), ns); + actionStr.insert(*ns, 0); + } + else actionStr.insert(scope.module->name(), 0); + actionStr.replaceAll('\'', '@', 0); } - else if (scope.checkHint(MethodHint::Protected)) { + else if (MethodInfo::checkVisibility(scope.info, MethodHint::Protected)) { if (actionStr.compare(CONSTRUCTOR_MESSAGE) && paramCount == 0) { //HOTFIX : protected default constructor has a special name actionStr.copy(CONSTRUCTOR_MESSAGE2); @@ -3897,7 +3979,7 @@ void Compiler::declareVMTMessage(MethodScope& scope, SyntaxNode node, bool witho else scope.message = declaredMssg; } } - else if (scope.checkHint(MethodHint::Private)) { + else if (MethodInfo::checkVisibility(scope.info, MethodHint::Private)) { flags |= STATIC_MESSAGE; } @@ -3994,7 +4076,7 @@ void Compiler::inheritStaticMethods(ClassScope& scope, SyntaxNode classNode) auto methodInfo = *it; mssg_t key = it.key(); - if (!methodInfo.inherited && MethodScope::checkType(methodInfo, MethodHint::Sealed) && + if (!methodInfo.inherited && MethodInfo::checkType(methodInfo, MethodHint::Sealed) && MethodScope::checkHint(methodInfo, MethodHint::Static)) { scope.info.attributes.add({ it.key(), ClassAttribute::SealedStatic }, scope.reference); @@ -4418,15 +4500,15 @@ inline void fillObject(BuildTreeWriter& writer, ClassInfo& info, int ptrSize) { // NOTE : for simplicity FillOp is used switch (ptrSize) { - case 4: - writer.appendNode(BuildKey::FillOp, align(info.size, 4) >> 2); - break; - case 8: - writer.appendNode(BuildKey::FillOp, align(info.size, 8) >> 3); - break; - default: - assert(false); - break; + case 4: + writer.appendNode(BuildKey::FillOp, align(info.size, 4) >> 2); + break; + case 8: + writer.appendNode(BuildKey::FillOp, align(info.size, 8) >> 3); + break; + default: + assert(false); + break; } } @@ -4453,19 +4535,19 @@ inline void copyArray(BuildTreeWriter& writer, int size) inline bool isBoxingRequired(ObjectInfo info, bool allowByRefParam) { switch (info.kind) { - case ObjectKind::LocalAddress: - case ObjectKind::TempLocalAddress: - case ObjectKind::ParamAddress: - case ObjectKind::ByRefParamAddress: - case ObjectKind::OutParamAddress: - case ObjectKind::SelfBoxableLocal: - case ObjectKind::FieldAddress: - return true; - case ObjectKind::ParamReference: - if (!allowByRefParam) + case ObjectKind::LocalAddress: + case ObjectKind::TempLocalAddress: + case ObjectKind::ParamAddress: + case ObjectKind::ByRefParamAddress: + case ObjectKind::OutParamAddress: + case ObjectKind::SelfBoxableLocal: + case ObjectKind::FieldAddress: return true; - default: - return false; + case ObjectKind::ParamReference: + if (!allowByRefParam) + return true; + default: + return false; } } @@ -4523,63 +4605,63 @@ ref_t Compiler::retrieveType(Scope& scope, ObjectInfo info) else return info.typeInfo.typeRef; } -ref_t Compiler::resolvePrimitiveType(ModuleScopeBase& moduleScope, TypeInfo typeInfo, +ref_t Compiler :: resolvePrimitiveType(ModuleScopeBase& moduleScope, TypeInfo typeInfo, bool declarationMode) { switch (typeInfo.typeRef) { - case V_UINT8: - return moduleScope.buildins.uint8Reference; - case V_INT8: - return moduleScope.buildins.int8Reference; - case V_INT16: - return moduleScope.buildins.shortReference; - case V_UINT16: - return moduleScope.buildins.ushortReference; - case V_INT32: - return moduleScope.buildins.intReference; - case V_INT64: - return moduleScope.buildins.longReference; - case V_FLOAT64: - return moduleScope.buildins.realReference; - case V_UINT32: - return moduleScope.buildins.uintReference; - case V_STRING: - return moduleScope.buildins.literalReference; - case V_WIDESTRING: - return moduleScope.buildins.wideReference; - case V_MESSAGE: - return moduleScope.buildins.messageReference; - case V_MESSAGENAME: - return moduleScope.buildins.messageNameReference; - case V_EXTMESSAGE64: - case V_EXTMESSAGE128: - return moduleScope.buildins.extMessageReference; - case V_FLAG: - return moduleScope.branchingInfo.typeRef; - case V_WRAPPER: - case V_OUTWRAPPER: - return resolveWrapperTemplate(moduleScope, typeInfo.elementRef, declarationMode); - case V_INT8ARRAY: - case V_INT16ARRAY: - case V_INT32ARRAY: - case V_FLOAT64ARRAY: - case V_BINARYARRAY: - return resolveArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); - //case V_NULLABLE: - // return resolveNullableTemplate(moduleScope, ns, typeInfo.elementRef, declarationMode); - case V_NIL: - return moduleScope.buildins.superReference; - case V_ARGARRAY: - return resolveArgArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); - case V_OBJARRAY: - return resolveArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); - case V_PTR32: - case V_PTR64: - return moduleScope.buildins.pointerReference; - case V_SYMBOL: - return moduleScope.buildins.superReference; - default: - return 0; + case V_UINT8: + return moduleScope.buildins.uint8Reference; + case V_INT8: + return moduleScope.buildins.int8Reference; + case V_INT16: + return moduleScope.buildins.shortReference; + case V_UINT16: + return moduleScope.buildins.ushortReference; + case V_INT32: + return moduleScope.buildins.intReference; + case V_INT64: + return moduleScope.buildins.longReference; + case V_FLOAT64: + return moduleScope.buildins.realReference; + case V_UINT32: + return moduleScope.buildins.uintReference; + case V_STRING: + return moduleScope.buildins.literalReference; + case V_WIDESTRING: + return moduleScope.buildins.wideReference; + case V_MESSAGE: + return moduleScope.buildins.messageReference; + case V_MESSAGENAME: + return moduleScope.buildins.messageNameReference; + case V_EXTMESSAGE64: + case V_EXTMESSAGE128: + return moduleScope.buildins.extMessageReference; + case V_FLAG: + return moduleScope.branchingInfo.typeRef; + case V_WRAPPER: + case V_OUTWRAPPER: + return resolveWrapperTemplate(moduleScope, typeInfo.elementRef, declarationMode); + case V_INT8ARRAY: + case V_INT16ARRAY: + case V_INT32ARRAY: + case V_FLOAT64ARRAY: + case V_BINARYARRAY: + return resolveArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); + //case V_NULLABLE: + // return resolveNullableTemplate(moduleScope, ns, typeInfo.elementRef, declarationMode); + case V_NIL: + return moduleScope.buildins.superReference; + case V_ARGARRAY: + return resolveArgArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); + case V_OBJARRAY: + return resolveArrayTemplate(moduleScope, typeInfo.elementRef, declarationMode); + case V_PTR32: + case V_PTR64: + return moduleScope.buildins.pointerReference; + case V_SYMBOL: + return moduleScope.buildins.superReference; + default: + return 0; } } @@ -4588,17 +4670,17 @@ void Compiler::declareClassAttributes(ClassScope& scope, SyntaxNode node, ref_t& SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Attribute: - if (!_logic->validateClassAttribute(current.arg.value, flags, scope.visibility)) { - current.setArgumentValue(0); // HOTFIX : to prevent duplicate warnings - scope.raiseWarning(WARNING_LEVEL_1, wrnInvalidHint, current); - } - break; - case SyntaxKey::Type: - scope.raiseError(errInvalidSyntax, current); - break; - default: - break; + case SyntaxKey::Attribute: + if (!_logic->validateClassAttribute(current.arg.value, flags, scope.visibility)) { + current.setArgumentValue(0); // HOTFIX : to prevent duplicate warnings + scope.raiseWarning(WARNING_LEVEL_1, wrnInvalidHint, current); + } + break; + case SyntaxKey::Type: + scope.raiseError(errInvalidSyntax, current); + break; + default: + break; } current = current.nextNode(); @@ -5264,12 +5346,12 @@ void Compiler::validateType(Scope& scope, ref_t typeRef, SyntaxNode node, bool i { if (!typeRef) { switch (node.key) { - case SyntaxKey::string: - scope.raiseError(errInvalidSyntax, node); - break; - default: - scope.raiseError(errUnknownClass, node); - break; + case SyntaxKey::string: + scope.raiseError(errInvalidSyntax, node); + break; + default: + scope.raiseError(errUnknownClass, node); + break; } } @@ -5511,28 +5593,28 @@ TypeInfo Compiler::resolveTypeScope(Scope& scope, SyntaxNode node, TypeAttribute SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Attribute: - if (!_logic->validateTypeScopeAttribute(current.arg.reference, attributes)) - scope.raiseWarning(WARNING_LEVEL_1, wrnInvalidHint, current); - break; - case SyntaxKey::Type: - elementRef = resolveStrongTypeAttribute(scope, current, declarationMode, false).typeRef; - break; - case SyntaxKey::TemplateType: - elementRef = resolveTypeAttribute(scope, current, attributes, declarationMode, allowRole).typeRef; - break; - case SyntaxKey::identifier: - case SyntaxKey::reference: - elementRef = resolveTypeIdentifier(scope, current.identifier(), node.key, declarationMode, allowRole); - break; - case SyntaxKey::NullableType: - case SyntaxKey::ArrayType: - elementRef = resolvePrimitiveType(*scope.moduleScope, - resolveTypeAttribute(scope, current, attributes, declarationMode, allowRole), declarationMode); - break; - default: - assert(false); - break; + case SyntaxKey::Attribute: + if (!_logic->validateTypeScopeAttribute(current.arg.reference, attributes)) + scope.raiseWarning(WARNING_LEVEL_1, wrnInvalidHint, current); + break; + case SyntaxKey::Type: + elementRef = resolveStrongTypeAttribute(scope, current, declarationMode, false).typeRef; + break; + case SyntaxKey::TemplateType: + elementRef = resolveTypeAttribute(scope, current, attributes, declarationMode, allowRole).typeRef; + break; + case SyntaxKey::identifier: + case SyntaxKey::reference: + elementRef = resolveTypeIdentifier(scope, current.identifier(), node.key, declarationMode, allowRole); + break; + case SyntaxKey::NullableType: + case SyntaxKey::ArrayType: + elementRef = resolvePrimitiveType(*scope.moduleScope, + resolveTypeAttribute(scope, current, attributes, declarationMode, allowRole), declarationMode); + break; + default: + assert(false); + break; } current = current.nextNode(); @@ -6268,7 +6350,7 @@ SyntaxNode Compiler::addStaticInitializerMethod(ClassScope& scope, SyntaxNode no SyntaxNode staticInitializer = rootNode.firstChild(SyntaxKey::StaticInitializerMethod); if (staticInitializer == SyntaxKey::None) { - IdentifierString sectionName(scope.module->resolveReference(scope.reference)); + ReferenceProperName sectionName(scope.module->resolveReference(scope.reference)); sectionName.append(INITIALIZER_SECTION); ref_t actionRef = scope.moduleScope->mapAnonymous(*sectionName); @@ -6294,60 +6376,60 @@ ref_t Compiler::compileStaticAssigning(ClassScope& scope, SyntaxNode node) mssg_t Compiler::resolveOperatorMessage(ModuleScopeBase* scope, int operatorId) { switch (operatorId) { - case INDEX_OPERATOR_ID: - return scope->buildins.refer_message; - case ADD_OPERATOR_ID: - return scope->buildins.add_message; - case SUB_OPERATOR_ID: - return scope->buildins.sub_message; - case MUL_OPERATOR_ID: - return scope->buildins.mul_message; - case DIV_OPERATOR_ID: - return scope->buildins.div_message; - case BAND_OPERATOR_ID: - return scope->buildins.band_message; - case BOR_OPERATOR_ID: - return scope->buildins.bor_message; - case BXOR_OPERATOR_ID: - return scope->buildins.bxor_message; - case IF_OPERATOR_ID: - return scope->buildins.if_message; - case IF_ELSE_OPERATOR_ID: - return overwriteArgCount(scope->buildins.if_message, 3); - case EQUAL_OPERATOR_ID: - return scope->buildins.equal_message; - case NOTEQUAL_OPERATOR_ID: - return scope->buildins.notequal_message; - case LESS_OPERATOR_ID: - return scope->buildins.less_message; - case GREATER_OPERATOR_ID: - return scope->buildins.greater_message; - case NOT_OPERATOR_ID: - return scope->buildins.not_message; - case NOTLESS_OPERATOR_ID: - return scope->buildins.notless_message; - case NOTGREATER_OPERATOR_ID: - return scope->buildins.notgreater_message; - case NEGATE_OPERATOR_ID: - return scope->buildins.negate_message; - case VALUE_OPERATOR_ID: - return scope->buildins.value_message; - case SET_INDEXER_OPERATOR_ID: - return scope->buildins.set_refer_message; - case AND_OPERATOR_ID: - return scope->buildins.and_message; - case OR_OPERATOR_ID: - return scope->buildins.or_message; - case XOR_OPERATOR_ID: - return scope->buildins.xor_message; - case SHL_OPERATOR_ID: - return scope->buildins.shl_message; - case SHR_OPERATOR_ID: - return scope->buildins.shr_message; - case BNOT_OPERATOR_ID: - return scope->buildins.bnot_message; - default: - throw InternalError(errFatalError); + case INDEX_OPERATOR_ID: + return scope->buildins.refer_message; + case ADD_OPERATOR_ID: + return scope->buildins.add_message; + case SUB_OPERATOR_ID: + return scope->buildins.sub_message; + case MUL_OPERATOR_ID: + return scope->buildins.mul_message; + case DIV_OPERATOR_ID: + return scope->buildins.div_message; + case BAND_OPERATOR_ID: + return scope->buildins.band_message; + case BOR_OPERATOR_ID: + return scope->buildins.bor_message; + case BXOR_OPERATOR_ID: + return scope->buildins.bxor_message; + case IF_OPERATOR_ID: + return scope->buildins.if_message; + case IF_ELSE_OPERATOR_ID: + return overwriteArgCount(scope->buildins.if_message, 3); + case EQUAL_OPERATOR_ID: + return scope->buildins.equal_message; + case NOTEQUAL_OPERATOR_ID: + return scope->buildins.notequal_message; + case LESS_OPERATOR_ID: + return scope->buildins.less_message; + case GREATER_OPERATOR_ID: + return scope->buildins.greater_message; + case NOT_OPERATOR_ID: + return scope->buildins.not_message; + case NOTLESS_OPERATOR_ID: + return scope->buildins.notless_message; + case NOTGREATER_OPERATOR_ID: + return scope->buildins.notgreater_message; + case NEGATE_OPERATOR_ID: + return scope->buildins.negate_message; + case VALUE_OPERATOR_ID: + return scope->buildins.value_message; + case SET_INDEXER_OPERATOR_ID: + return scope->buildins.set_refer_message; + case AND_OPERATOR_ID: + return scope->buildins.and_message; + case OR_OPERATOR_ID: + return scope->buildins.or_message; + case XOR_OPERATOR_ID: + return scope->buildins.xor_message; + case SHL_OPERATOR_ID: + return scope->buildins.shl_message; + case SHR_OPERATOR_ID: + return scope->buildins.shr_message; + case BNOT_OPERATOR_ID: + return scope->buildins.bnot_message; + default: + throw InternalError(errFatalError); } } @@ -6451,7 +6533,7 @@ ref_t targetResolver(void* param, mssg_t mssg) return ((ResolvedMap*)param)->get(mssg); } -ref_t Compiler::compileExtensionDispatcher(BuildTreeWriter& writer, NamespaceScope& scope, mssg_t genericMessage, +ref_t Compiler :: compileExtensionDispatcher(BuildTreeWriter& writer, NamespaceScope& scope, mssg_t genericMessage, ref_t outputRef) { ref_t extRef = scope.moduleScope->mapAnonymous(); @@ -6474,8 +6556,10 @@ ref_t Compiler::compileExtensionDispatcher(BuildTreeWriter& writer, NamespaceSco targets.add(extInfo.value2, extInfo.value1); } + + _logic->injectMethodOverloadList(this, *scope.moduleScope, - classScope.info.header.flags, genericMessage | FUNCTION_MESSAGE, methods, + MethodHint::Sealed, genericMessage | FUNCTION_MESSAGE, methods, classScope.info.attributes, &targets, targetResolver, ClassAttribute::OverloadList); SyntaxTree classTree; @@ -6861,127 +6945,127 @@ ObjectInfo Compiler::defineTerminalInfo(Scope& scope, SyntaxNode node, TypeInfo bool invalidForNonIdentifier = terminalAttrs.isAnySet() || distributedMode; switch (node.key) { - case SyntaxKey::TemplateType: - { - TypeAttributes typeAttributes = {}; - TypeInfo typeInfo = resolveTypeAttribute(scope, node, typeAttributes, false, false); - retVal = { ObjectKind::Class, typeInfo, 0u }; + case SyntaxKey::TemplateType: + { + TypeAttributes typeAttributes = {}; + TypeInfo typeInfo = resolveTypeAttribute(scope, node, typeAttributes, false, false); + retVal = { ObjectKind::Class, typeInfo, 0u }; - retVal = mapClassSymbol(scope, resolveStrongType(scope, retVal.typeInfo)); - break; - } - case SyntaxKey::globalreference: - invalid = terminalAttrs.variableMode; - retVal = scope.mapGlobal(node.identifier()); - break; - case SyntaxKey::identifier: - case SyntaxKey::reference: - if (terminalAttrs.variableMode) { - invalid = terminalAttrs.forwardMode; + retVal = mapClassSymbol(scope, resolveStrongType(scope, retVal.typeInfo)); + break; + } + case SyntaxKey::globalreference: + invalid = terminalAttrs.variableMode; + retVal = scope.mapGlobal(node.identifier()); + break; + case SyntaxKey::identifier: + case SyntaxKey::reference: + if (terminalAttrs.variableMode) { + invalid = terminalAttrs.forwardMode; - if (declareVariable(scope, node, declaredTypeInfo, ignoreDuplicates)) { - retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, - attrs | ExpressionAttribute::Local); + if (declareVariable(scope, node, declaredTypeInfo, ignoreDuplicates)) { + retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, + attrs | ExpressionAttribute::Local); - if (_trackingUnassigned && terminalAttrs.outRefOp) { - scope.markAsAssigned(retVal); + if (_trackingUnassigned && terminalAttrs.outRefOp) { + scope.markAsAssigned(retVal); + } } + else retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, attrs); } - else retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, attrs); - } - else if (terminalAttrs.forwardMode) { - IdentifierString forwardName(FORWARD_PREFIX_NS, node.identifier()); + else if (terminalAttrs.forwardMode) { + IdentifierString forwardName(FORWARD_PREFIX_NS, node.identifier()); - retVal = scope.mapIdentifier(*forwardName, true, attrs); - } - else if (distributedMode) { - retVal = scope.mapDictionary(node.identifier(), node.key == SyntaxKey::reference, attrs | EAttr::StrongResolved); - if (retVal.kind == ObjectKind::TypeList) { - retVal.kind = ObjectKind::DistributedTypeList; + retVal = scope.mapIdentifier(*forwardName, true, attrs); } - else return {}; - } - else if (terminalAttrs.memberMode) { - retVal = scope.mapMember(node.identifier()); - } - else retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, attrs); + else if (distributedMode) { + retVal = scope.mapDictionary(node.identifier(), node.key == SyntaxKey::reference, attrs | EAttr::StrongResolved); + if (retVal.kind == ObjectKind::TypeList) { + retVal.kind = ObjectKind::DistributedTypeList; + } + else return {}; + } + else if (terminalAttrs.memberMode) { + retVal = scope.mapMember(node.identifier()); + } + else retVal = scope.mapIdentifier(node.identifier(), node.key == SyntaxKey::reference, attrs); - if (terminalAttrs.refOp || terminalAttrs.outRefOp) { - switch (retVal.kind) { - case ObjectKind::LocalAddress: - retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; - break; - case ObjectKind::ParamAddress: - retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; - break; - case ObjectKind::Local: - retVal.kind = ObjectKind::RefLocal; - retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; - break; - case ObjectKind::ByRefParam: - case ObjectKind::OutParam: - // allowing to pass by ref parameter directly - retVal.kind = ObjectKind::ParamReference; - retVal.typeInfo = { retVal.kind == ObjectKind::OutParam ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; - break; - case ObjectKind::OutParamAddress: - case ObjectKind::ByRefParamAddress: - // allowing to pass by ref parameter directly - retVal.kind = ObjectKind::ParamAddress; - retVal.typeInfo = { retVal.kind == ObjectKind::OutParamAddress ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; - //retVal.mode = TargetMode::UnboxingRequired; - break; - default: - invalid = true; - break; + if (terminalAttrs.refOp || terminalAttrs.outRefOp) { + switch (retVal.kind) { + case ObjectKind::LocalAddress: + retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; + break; + case ObjectKind::ParamAddress: + retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; + break; + case ObjectKind::Local: + retVal.kind = ObjectKind::RefLocal; + retVal.typeInfo = { terminalAttrs.outRefOp ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; + break; + case ObjectKind::ByRefParam: + case ObjectKind::OutParam: + // allowing to pass by ref parameter directly + retVal.kind = ObjectKind::ParamReference; + retVal.typeInfo = { retVal.kind == ObjectKind::OutParam ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; + break; + case ObjectKind::OutParamAddress: + case ObjectKind::ByRefParamAddress: + // allowing to pass by ref parameter directly + retVal.kind = ObjectKind::ParamAddress; + retVal.typeInfo = { retVal.kind == ObjectKind::OutParamAddress ? V_OUTWRAPPER : V_WRAPPER, retVal.typeInfo.typeRef }; + //retVal.mode = TargetMode::UnboxingRequired; + break; + default: + invalid = true; + break; + } } - } - break; - case SyntaxKey::string: - case SyntaxKey::interpolate: - invalid = invalidForNonIdentifier; + break; + case SyntaxKey::string: + case SyntaxKey::interpolate: + invalid = invalidForNonIdentifier; - retVal = mapStringConstant(scope, node); - break; - case SyntaxKey::wide: - invalid = invalidForNonIdentifier; + retVal = mapStringConstant(scope, node); + break; + case SyntaxKey::wide: + invalid = invalidForNonIdentifier; - retVal = mapWideStringConstant(scope, node); - break; - case SyntaxKey::character: - invalid = invalidForNonIdentifier; + retVal = mapWideStringConstant(scope, node); + break; + case SyntaxKey::character: + invalid = invalidForNonIdentifier; - retVal = mapCharacterConstant(scope, node); - break; - case SyntaxKey::integer: - invalid = invalidForNonIdentifier; + retVal = mapCharacterConstant(scope, node); + break; + case SyntaxKey::integer: + invalid = invalidForNonIdentifier; - retVal = mapIntConstant(scope, node, 10); - break; - case SyntaxKey::hexinteger: - invalid = invalidForNonIdentifier; + retVal = mapIntConstant(scope, node, 10); + break; + case SyntaxKey::hexinteger: + invalid = invalidForNonIdentifier; - retVal = mapUIntConstant(scope, node, 16); - break; - case SyntaxKey::longinteger: - invalid = invalidForNonIdentifier; + retVal = mapUIntConstant(scope, node, 16); + break; + case SyntaxKey::longinteger: + invalid = invalidForNonIdentifier; - retVal = mapLongConstant(scope, node, 10); - break; - case SyntaxKey::real: - invalid = invalidForNonIdentifier; + retVal = mapLongConstant(scope, node, 10); + break; + case SyntaxKey::real: + invalid = invalidForNonIdentifier; - retVal = mapFloat64Constant(scope, node); - break; - case SyntaxKey::constant: - invalid = invalidForNonIdentifier; + retVal = mapFloat64Constant(scope, node); + break; + case SyntaxKey::constant: + invalid = invalidForNonIdentifier; - retVal = mapConstant(scope, node); - break; - default: - // to make compiler happy - invalid = true; - break; + retVal = mapConstant(scope, node); + break; + default: + // to make compiler happy + invalid = true; + break; } if (EAttrs::test(attrs, EAttr::Weak)) { @@ -7294,25 +7378,46 @@ inline SyntaxNode findObjectNode(SyntaxNode node) return {}; } -ObjectInfo Compiler::compileRetExpression(BuildTreeWriter& writer, CodeScope& codeScope, SyntaxNode node, EAttr mode) +ObjectInfo Compiler :: compileRetExpression(BuildTreeWriter& writer, CodeScope& codeScope, SyntaxNode node, EAttr mode) { + ObjectInfo retVal = {}; + Expression expression(this, codeScope, writer); - bool autoMode = false; - TypeInfo outputInfo = {}; - if (codeScope.isByRefHandler()) { - ObjectInfo byRefTarget = codeScope.mapByRefReturnArg(); + MethodScope* methodScope = Scope::getScope(codeScope, Scope::ScopeLevel::Method); + if (methodScope && methodScope->isYieldable()) { + StatemachineClassScope* smScope = Scope::getScope(codeScope, Scope::ScopeLevel::Statemachine); + assert(smScope != nullptr); + if (smScope->asyncMode) { + expression.compileAsyncOperation(node, false); - outputInfo = byRefTarget.typeInfo; - } - else outputInfo = codeScope.getOutputInfo(); + retVal = { ObjectKind::Singleton, { codeScope.moduleScope->branchingInfo.typeRef }, codeScope.moduleScope->branchingInfo.falseRef }; + expression.writeObjectInfo(retVal); - if (outputInfo.typeRef == V_AUTO) { - autoMode = true; - outputInfo = {}; + writer.appendNode(BuildKey::goingToEOP); + } + else codeScope.raiseError(errInvalidOperation, node); } + else { + bool autoMode = false; + TypeInfo outputInfo = {}; + if (codeScope.isByRefHandler()) { + ObjectInfo byRefTarget = codeScope.mapByRefReturnArg(); - ObjectInfo retVal = expression.compileReturning(node, mode, outputInfo); + outputInfo = byRefTarget.typeInfo; + } + else outputInfo = codeScope.getOutputInfo(); + + if (outputInfo.typeRef == V_AUTO) { + autoMode = true; + outputInfo = {}; + } + + retVal = expression.compileReturning(node, mode, outputInfo); + + if (autoMode) + outputInfo.typeRef = resolveStrongType(codeScope, retVal.typeInfo); + } codeScope.withRetStatement = true; @@ -7493,113 +7598,121 @@ void Compiler::endMethod(BuildTreeWriter& writer, MethodScope& scope) writer.closeNode(); } -void Compiler::injectVariableInfo(BuildNode node, CodeScope& codeScope) +void Compiler :: addVariableInfo(BuildNode node, Scope& scope, ustr_t name, Parameter& localInfo) { - for (auto it = codeScope.locals.start(); !it.eof(); ++it) { - auto localInfo = *it; - bool embeddableArray = false; - if (localInfo.typeInfo.typeRef) { - ref_t typeRef = localInfo.typeInfo.typeRef; + ModuleScopeBase* moduleScope = scope.moduleScope; - if (localInfo.typeInfo.isPrimitive() && localInfo.typeInfo.elementRef) - typeRef = resolvePrimitiveType(*codeScope.moduleScope, localInfo.typeInfo, false); + bool embeddableArray = false; + if (localInfo.typeInfo.typeRef) { + ref_t typeRef = localInfo.typeInfo.typeRef; - embeddableArray = _logic->isEmbeddableArray(*codeScope.moduleScope, typeRef); - if (embeddableArray && localInfo.size > 0) { - node.appendChild(BuildKey::BinaryArray, localInfo.offset) - .appendChild(BuildKey::Size, localInfo.size); - } + if (localInfo.typeInfo.isPrimitive() && localInfo.typeInfo.elementRef) + typeRef = resolvePrimitiveType(*scope.moduleScope, localInfo.typeInfo, false); + + embeddableArray = _logic->isEmbeddableArray(*scope.moduleScope, typeRef); + if (embeddableArray && localInfo.size > 0) { + node.appendChild(BuildKey::BinaryArray, localInfo.offset) + .appendChild(BuildKey::Size, localInfo.size); } + } - if (localInfo.size > 0) { - if (embeddableArray) { - if (_logic->isCompatible(*codeScope.moduleScope, - { V_INT8 }, { localInfo.typeInfo.elementRef }, false)) - { - BuildNode varNode = node.appendChild(BuildKey::ByteArrayAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (_logic->isCompatible(*codeScope.moduleScope, - { V_UINT8 }, { localInfo.typeInfo.elementRef }, false)) - { - BuildNode varNode = node.appendChild(BuildKey::ByteArrayAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (_logic->isCompatible(*codeScope.moduleScope, - { V_INT16 }, { localInfo.typeInfo.elementRef }, false)) - { - BuildNode varNode = node.appendChild(BuildKey::ShortArrayAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (_logic->isCompatible(*codeScope.moduleScope, - { V_INT32 }, { localInfo.typeInfo.elementRef }, false)) - { - BuildNode varNode = node.appendChild(BuildKey::IntArrayAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.intReference) { - BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.uintReference) { - BuildNode varNode = node.appendChild(BuildKey::UIntVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.int8Reference) { - BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.uint8Reference) { - BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.shortReference) { - BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.longReference) { - BuildNode varNode = node.appendChild(BuildKey::LongVariableAddress, it.key()); - varNode.appendChild(BuildKey::Index, localInfo.offset); - } - else if (localInfo.typeInfo.typeRef == codeScope.moduleScope->buildins.realReference) { - BuildNode varNode = node.appendChild(BuildKey::RealVariableAddress, it.key()); + if (localInfo.size > 0) { + if (embeddableArray) { + if (_logic->isCompatible(*moduleScope, + { V_INT8 }, { localInfo.typeInfo.elementRef }, false)) + { + BuildNode varNode = node.appendChild(BuildKey::ByteArrayAddress, name); varNode.appendChild(BuildKey::Index, localInfo.offset); } - else if (_logic->isCompatible(*codeScope.moduleScope, - { V_INT32 }, { localInfo.typeInfo.typeRef }, false)) + else if (_logic->isCompatible(*moduleScope, + { V_UINT8 }, { localInfo.typeInfo.elementRef }, false)) { - BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, it.key()); + BuildNode varNode = node.appendChild(BuildKey::ByteArrayAddress, name); varNode.appendChild(BuildKey::Index, localInfo.offset); } - else if (_logic->isCompatible(*codeScope.moduleScope, - { V_INT64 }, { localInfo.typeInfo.typeRef }, false)) + else if (_logic->isCompatible(*moduleScope, + { V_INT16 }, { localInfo.typeInfo.elementRef }, false)) { - BuildNode varNode = node.appendChild(BuildKey::LongVariableAddress, it.key()); + BuildNode varNode = node.appendChild(BuildKey::ShortArrayAddress, name); varNode.appendChild(BuildKey::Index, localInfo.offset); } - else { - BuildNode varNode = node.appendChild(BuildKey::VariableAddress, it.key()); + else if (_logic->isCompatible(*moduleScope, + { V_INT32 }, { localInfo.typeInfo.elementRef }, false)) + { + BuildNode varNode = node.appendChild(BuildKey::IntArrayAddress, name); varNode.appendChild(BuildKey::Index, localInfo.offset); - - ustr_t className = codeScope.moduleScope->module->resolveReference(localInfo.typeInfo.typeRef); - if (isWeakReference(className)) { - IdentifierString fullName(codeScope.module->name()); - fullName.append(className); - - varNode.appendChild(BuildKey::ClassName, *fullName); - } - else varNode.appendChild(BuildKey::ClassName, className); } } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.intReference) { + BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.uintReference) { + BuildNode varNode = node.appendChild(BuildKey::UIntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.int8Reference) { + BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.uint8Reference) { + BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.shortReference) { + BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.longReference) { + BuildNode varNode = node.appendChild(BuildKey::LongVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (localInfo.typeInfo.typeRef == moduleScope->buildins.realReference) { + BuildNode varNode = node.appendChild(BuildKey::RealVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (_logic->isCompatible(*moduleScope, + { V_INT32 }, { localInfo.typeInfo.typeRef }, false)) + { + BuildNode varNode = node.appendChild(BuildKey::IntVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } + else if (_logic->isCompatible(*moduleScope, + { V_INT64 }, { localInfo.typeInfo.typeRef }, false)) + { + BuildNode varNode = node.appendChild(BuildKey::LongVariableAddress, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } else { - BuildNode varNode = node.appendChild(BuildKey::Variable, it.key()); + BuildNode varNode = node.appendChild(BuildKey::VariableAddress, name); varNode.appendChild(BuildKey::Index, localInfo.offset); + + ustr_t className = moduleScope->module->resolveReference(localInfo.typeInfo.typeRef); + if (isWeakReference(className)) { + IdentifierString fullName(scope.module->name()); + fullName.append(className); + + varNode.appendChild(BuildKey::ClassName, *fullName); + } + else varNode.appendChild(BuildKey::ClassName, className); } } + else { + BuildNode varNode = node.appendChild(BuildKey::Variable, name); + varNode.appendChild(BuildKey::Index, localInfo.offset); + } +} + + +void Compiler :: injectVariablesInfo(BuildNode node, CodeScope& codeScope) +{ + for (auto it = codeScope.locals.start(); !it.eof(); ++it) { + auto localInfo = *it; + addVariableInfo(node, codeScope, it.key(), localInfo); + } } -ObjectInfo Compiler::compileCode(BuildTreeWriter& writer, CodeScope& codeScope, SyntaxNode node, bool closureMode, bool noDebugInfoMode) +ObjectInfo Compiler :: compileCode(BuildTreeWriter& writer, CodeScope& codeScope, SyntaxNode node, bool closureMode, bool noDebugInfoMode) { ObjectInfo retVal = {}; ObjectInfo exprRetVal = {}; @@ -7619,41 +7732,41 @@ ObjectInfo Compiler::compileCode(BuildTreeWriter& writer, CodeScope& codeScope, SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Expression: - exprRetVal = compileRootExpression(writer, codeScope, current, mode); - break; - case SyntaxKey::ReturnExpression: - exprRetVal = retVal = compileRetExpression(writer, codeScope, current, EAttr::None); - break; - case SyntaxKey::CodeBlock: - { - bool autoGenerated = current.existChild(SyntaxKey::Autogenerated); + case SyntaxKey::Expression: + exprRetVal = compileRootExpression(writer, codeScope, current, mode); + break; + case SyntaxKey::ReturnExpression: + exprRetVal = retVal = compileRetExpression(writer, codeScope, current, EAttr::None); + break; + case SyntaxKey::CodeBlock: + { + bool autoGenerated = current.existChild(SyntaxKey::Autogenerated); - if (!noDebugInfoMode && autoGenerated) { - writer.appendNode(BuildKey::OpenStatement); - addBreakpoint(writer, findObjectNode(current.firstChild()), BuildKey::Breakpoint); - } + if (!noDebugInfoMode && autoGenerated) { + writer.appendNode(BuildKey::OpenStatement); + addBreakpoint(writer, findObjectNode(current.firstChild()), BuildKey::Breakpoint); + } - CodeScope subScope(&codeScope); - exprRetVal = compileCode(writer, subScope, current, false, autoGenerated || !_withDebugInfo); - subScope.syncStack(&codeScope); + CodeScope subScope(&codeScope); + exprRetVal = compileCode(writer, subScope, current, false, autoGenerated || !_withDebugInfo); + subScope.syncStack(&codeScope); - if (!noDebugInfoMode && autoGenerated) - writer.appendNode(BuildKey::EndStatement); - break; - } - case SyntaxKey::EOP: - addBreakpoint(writer, current, BuildKey::EOPBreakpoint); - break; - default: - break; + if (!noDebugInfoMode && autoGenerated) + writer.appendNode(BuildKey::EndStatement); + break; + } + case SyntaxKey::EOP: + addBreakpoint(writer, current, BuildKey::EOPBreakpoint); + break; + default: + break; } current = current.nextNode(); } if (!noDebugInfoMode) - injectVariableInfo(variableNode, codeScope); + injectVariablesInfo(variableNode, codeScope); // NOTE : in the closure mode the last statement is the closure result return closureMode ? exprRetVal : retVal; @@ -7731,34 +7844,34 @@ void Compiler :: compileMethodCode(BuildTreeWriter& writer, ClassScope* classSco SyntaxNode bodyNode = node.firstChild(SyntaxKey::ScopeMask); switch (bodyNode.key) { - case SyntaxKey::CodeBlock: - retVal = compileCode(writer, codeScope, bodyNode, scope.closureMode, !_withDebugInfo); - break; - case SyntaxKey::ReturnExpression: - retVal = compileRetExpression(writer, codeScope, bodyNode, EAttr::None); - break; - case SyntaxKey::ResendDispatch: - retVal = compileResendCode(writer, codeScope, - scope.constructorMode ? mapConstructorTarget(scope) : scope.mapSelf(), - bodyNode); + case SyntaxKey::CodeBlock: + retVal = compileCode(writer, codeScope, bodyNode, scope.closureMode, !_withDebugInfo); + break; + case SyntaxKey::ReturnExpression: + retVal = compileRetExpression(writer, codeScope, bodyNode, EAttr::None); + break; + case SyntaxKey::ResendDispatch: + retVal = compileResendCode(writer, codeScope, + scope.constructorMode ? mapConstructorTarget(scope) : scope.mapSelf(), + bodyNode); - if (codeScope.isByRefHandler() && retVal.kind != ObjectKind::Unknown) { - Expression expression(this, codeScope, writer); + if (codeScope.isByRefHandler() && retVal.kind != ObjectKind::Unknown) { + Expression expression(this, codeScope, writer); - expression.compileAssigning(node, codeScope.mapByRefReturnArg(), retVal); - } - else if (scope.info.outputRef != 0 && !scope.constructorMode) { - Expression expression(this, codeScope, writer); + expression.compileAssigning(node, codeScope.mapByRefReturnArg(), retVal); + } + else if (scope.info.outputRef != 0 && !scope.constructorMode) { + Expression expression(this, codeScope, writer); - expression.compileConverting(node, retVal, scope.info.outputRef, - scope.checkHint(MethodHint::Stacksafe)); - } - break; - case SyntaxKey::Redirect: - retVal = compileRedirect(writer, codeScope, bodyNode, scope.info.outputRef); - break; - default: - break; + expression.compileConverting(node, retVal, scope.info.outputRef, + scope.checkHint(MethodHint::Stacksafe)); + } + break; + case SyntaxKey::Redirect: + retVal = compileRedirect(writer, codeScope, bodyNode, scope.info.outputRef); + break; + default: + break; } if (_trackingUnassigned) { @@ -7878,7 +7991,7 @@ void Compiler::compileStaticInitializerMethod(BuildTreeWriter& writer, ClassScop nestedWriter.closeNode(); } -void Compiler::compileAbstractMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node, bool abstractMode) +void Compiler :: compileAbstractMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node, bool abstractMode) { SyntaxNode current = node.firstChild(SyntaxKey::MemberMask); if (current.key == SyntaxKey::WithoutBody) { @@ -7890,9 +8003,21 @@ void Compiler::compileAbstractMethod(BuildTreeWriter& writer, MethodScope& scope writer.newNode(BuildKey::AbstractMethod, scope.message); writer.closeNode(); + + if (scope.info.byRefHandler) { + writer.newNode(BuildKey::AbstractMethod, scope.info.byRefHandler); + writer.closeNode(); + } +} + +inline bool isIndexedOp(ClassInfo& info, mssg_t message) +{ + auto mi = info.methods.get(message); + + return MethodInfo::checkHint(mi, MethodHint::Indexed); } -void Compiler::compileMultidispatch(BuildTreeWriter& writer, CodeScope& scope, ClassScope& classScope, +void Compiler :: compileMultidispatch(BuildTreeWriter& writer, CodeScope& scope, ClassScope& classScope, SyntaxNode node, bool implicitMode) { mssg_t message = scope.getMessageID(); @@ -7902,12 +8027,15 @@ void Compiler::compileMultidispatch(BuildTreeWriter& writer, CodeScope& scope, C if (!opRef) scope.raiseError(errIllegalOperation, node); - if (test(classScope.info.header.flags, elSealed) || test(message, STATIC_MESSAGE)) { + if (test(classScope.info.header.flags, elSealed) || scope.isSealedMethod()) { op = BuildKey::SealedDispatchingOp; } writer.newNode(op, opRef); writer.appendNode(BuildKey::Message, message); + if (isIndexedOp(classScope.info, message)) { + writer.appendNode(BuildKey::IndexTableMode); + } writer.closeNode(); if (implicitMode) { @@ -8113,18 +8241,26 @@ void Compiler::compileDispatchProberCode(BuildTreeWriter& writer, CodeScope& sco mssg_t message = scope.getMessageID(); mssg_t dispatchMessage = node.arg.reference; + MethodInfo dispatchInfo = classScope->info.methods.get(dispatchMessage); + bool indexTableMode = false; BuildKey op = BuildKey::DispatchingOp; ref_t opRef = classScope->info.attributes.get({ dispatchMessage, ClassAttribute::OverloadList }); if (!opRef) scope.raiseError(errIllegalOperation, node); - if (test(classScope->info.header.flags, elSealed) || test(dispatchMessage, STATIC_MESSAGE)) { + if (MethodInfo::checkVisibility(dispatchInfo, MethodHint::Internal)) { + // NOTE : the check must preceed the next one to correctly deal with internal indexed messages + indexTableMode = true; + } + else if (test(classScope->info.header.flags, elSealed) || CompilerLogic::isSealedMethod(dispatchMessage, dispatchInfo)) { op = BuildKey::SealedDispatchingOp; } writer.newNode(op, opRef); writer.appendNode(BuildKey::Message, dispatchMessage); + if (indexTableMode) + writer.appendNode(BuildKey::IndexTableMode); writer.closeNode(); SyntaxNode targetNode = node.findChild(SyntaxKey::Target); @@ -8172,7 +8308,7 @@ mssg_t Compiler::declareInplaceConstructorHandler(MethodScope& invokerScope, Cla invokerScope.module->mapAction( actionName, invokerScope.module->mapSignature(signArgs, signLen, false), false), argCount + 1, flags | STATIC_MESSAGE); - if (MethodScope::checkHint(invokerScope.info, MethodHint::Protected)) { + if (MethodInfo::checkVisibility(invokerScope.info, MethodHint::Protected)) { mssg_t publicInplaceMessage = encodeMessage( invokerScope.module->mapAction( CONSTRUCTOR_MESSAGE, invokerScope.module->mapSignature(signArgs, signLen, false), false), argCount + 1, flags | STATIC_MESSAGE); @@ -8256,7 +8392,7 @@ mssg_t Compiler::compileInplaceConstructorHandler(BuildTreeWriter& writer, Metho return privateScope.message; } -mssg_t Compiler::compileByRefHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, mssg_t byRefHandler) +void Compiler :: compileByRefHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, mssg_t byRefHandler) { ClassScope* classScope = Scope::getScope(invokerScope, Scope::ScopeLevel::Class); @@ -8273,25 +8409,15 @@ mssg_t Compiler::compileByRefHandler(BuildTreeWriter& writer, MethodScope& invok int offset = invokerScope.parameters.count() + 1u; privateScope.parameters.add(RETVAL_ARG, { offset, refType, sizeInfo.size }); - privateScope.message = byRefHandler | STATIC_MESSAGE; - privateScope.info.hints |= (ref_t)MethodHint::Private; - privateScope.info.hints |= (ref_t)MethodHint::Sealed; - - // HOTFIX : mark it as stacksafe if required - if (_logic->isEmbeddableStruct(classScope->info)) - privateScope.info.hints |= (ref_t)MethodHint::Stacksafe; + privateScope.message = byRefHandler; + privateScope.info = classScope->info.methods.get(byRefHandler); privateScope.byRefReturnMode = true; privateScope.nestedMode = invokerScope.nestedMode; privateScope.functionMode = invokerScope.functionMode; privateScope.isEmbeddable = invokerScope.isEmbeddable; - classScope->info.methods.add(privateScope.message, privateScope.info); - classScope->save(); - compileMethod(writer, privateScope, node); - - return privateScope.message; } void Compiler::compileByRefRedirectHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, @@ -8377,7 +8503,7 @@ void Compiler::writeMessageInfo(BuildTreeWriter& writer, MethodScope& scope) writer.appendNode(BuildKey::MethodName, *methodName); } -void Compiler::writeParameterDebugInfo(BuildTreeWriter& writer, Scope& scope, int size, TypeInfo typeInfo, +void Compiler :: writeParameterDebugInfo(BuildTreeWriter& writer, Scope& scope, int size, TypeInfo typeInfo, ustr_t name, int index) { if (size > 0) { @@ -8432,10 +8558,22 @@ void Compiler::writeMethodDebugInfo(BuildTreeWriter& writer, MethodScope& scope) { writer.newNode(BuildKey::ArgumentsInfo); - if (!scope.functionMode) { + if (!scope.functionMode || scope.constructorMode) { ref_t classRef = scope.getClassRef(); + int classSize = _logic->defineStructSize(*scope.moduleScope, classRef).size; + + if (scope.constructorMode) { + Parameter selfParam = { 1, { classRef }, classSize, false }; + + writer.closeNode(); + + writer.newNode(BuildKey::VariableInfo); + addVariableInfo(writer.CurrentNode(), scope, "self", selfParam); + writer.closeNode(); - writeParameterDebugInfo(writer, scope, _logic->defineStructSize(*scope.moduleScope, classRef).size, + writer.newNode(BuildKey::ArgumentsInfo); + } + else writeParameterDebugInfo(writer, scope, classSize, { classRef }, "self", -1); } @@ -8459,49 +8597,44 @@ void Compiler::compileMethod(BuildTreeWriter& writer, MethodScope& scope, Syntax CodeScope codeScope(&scope); if (scope.info.byRefHandler && !scope.checkHint(MethodHint::InterfaceDispatcher)) { - if (current.key == SyntaxKey::Redirect) { - compileByRefRedirectHandler(writer, scope, node, scope.info.byRefHandler); - } - else { - mssg_t privateImplementation = compileByRefHandler(writer, scope, node, scope.info.byRefHandler); + compileByRefHandler(writer, scope, node, scope.info.byRefHandler); - beginMethod(writer, scope, node, BuildKey::Method, false); - compileByRefHandlerInvoker(writer, scope, codeScope, privateImplementation, scope.info.outputRef); - codeScope.syncStack(&scope); - endMethod(writer, scope); + beginMethod(writer, scope, node, BuildKey::Method, false); + compileByRefHandlerInvoker(writer, scope, codeScope, scope.info.byRefHandler, scope.info.outputRef); + codeScope.syncStack(&scope); + endMethod(writer, scope); - // NOTE : normal byrefhandler has an alternative implementation - // overriding the normal routine - return; - } + // NOTE : normal byrefhandler has an alternative implementation + // overriding the normal routine + return; } beginMethod(writer, scope, node, BuildKey::Method, _withDebugInfo); switch (current.key) { - case SyntaxKey::CodeBlock: - case SyntaxKey::ReturnExpression: - case SyntaxKey::ResendDispatch: - case SyntaxKey::Redirect: - compileMethodCode(writer, classScope, scope, codeScope, node, false); - break; - case SyntaxKey::DirectResend: - compileDirectResendCode(writer, codeScope, current); - break; - case SyntaxKey::Importing: - writer.appendNode(BuildKey::Import, current.arg.reference); - break; - case SyntaxKey::WithoutBody: - scope.raiseError(errNoBodyMethod, node); - break; - case SyntaxKey::RedirectDispatch: - compileDispatchCode(writer, codeScope, current); - break; - case SyntaxKey::RedirectTryDispatch: - compileDispatchProberCode(writer, codeScope, current); - break; - default: - break; + case SyntaxKey::CodeBlock: + case SyntaxKey::ReturnExpression: + case SyntaxKey::ResendDispatch: + case SyntaxKey::Redirect: + compileMethodCode(writer, classScope, scope, codeScope, node, false); + break; + case SyntaxKey::DirectResend: + compileDirectResendCode(writer, codeScope, current); + break; + case SyntaxKey::Importing: + writer.appendNode(BuildKey::Import, current.arg.reference); + break; + case SyntaxKey::WithoutBody: + scope.raiseError(errNoBodyMethod, node); + break; + case SyntaxKey::RedirectDispatch: + compileDispatchCode(writer, codeScope, current); + break; + case SyntaxKey::RedirectTryDispatch: + compileDispatchProberCode(writer, codeScope, current); + break; + default: + break; } codeScope.syncStack(&scope); @@ -8521,7 +8654,7 @@ void Compiler::checkUnassignedVariables(MethodScope& scope, SyntaxNode node) } } -ref_t Compiler::resolveYieldType(Scope& scope, SyntaxNode node) +ref_t Compiler :: resolveYieldType(Scope& scope, SyntaxNode node) { SyntaxNode current = node.findChild(SyntaxKey::TemplateType); if (current != SyntaxKey::None) { @@ -8533,33 +8666,52 @@ ref_t Compiler::resolveYieldType(Scope& scope, SyntaxNode node) return scope.moduleScope->buildins.superReference; } +ref_t Compiler :: declareAsyncStatemachine(StatemachineClassScope& scope, SyntaxNode node) +{ + SyntaxNode current = node.findChild(SyntaxKey::TemplateType); + if (current != SyntaxKey::None) { + auto typeInfo = resolveStrongTypeAttribute(scope, current.findChild(SyntaxKey::TemplateArg), true, false); + + scope.typeRef = resolveStateMachine(scope, scope.moduleScope->buildins.taskReference, typeInfo.typeRef); + scope.resultRef = typeInfo.typeRef; + + return resolveStateMachine(scope, scope.moduleScope->buildins.asyncStatemachineReference, typeInfo.typeRef); + } + else { + scope.typeRef = scope.moduleScope->buildins.taskReference; + + return scope.moduleScope->buildins.asyncStatemachineReference; + } +} + void Compiler :: compileAsyncMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node) { -/* CodeScope codeScope(&scope); Expression expression(this, codeScope, writer); - // create yield state machine + // declare a state machine enumerator ref_t nestedRef = scope.moduleScope->mapAnonymous(); - StatemachineClassScope smScope(&expression.scope, nestedRef); - smScope.typeRef = resolveYieldType(scope, node); + StatemachineClassScope smScope(&expression.scope, nestedRef, true); + ref_t baseRef = declareAsyncStatemachine(smScope, node); BuildNode buildNode = writer.CurrentNode(); while (buildNode != BuildKey::Root) buildNode = buildNode.parentNode(); BuildTreeWriter nestedWriter(buildNode); - compileStatemachineClass(nestedWriter, smScope, node); + compileStatemachineClass(nestedWriter, smScope, node, baseRef); + // create a async method beginMethod(writer, scope, node, BuildKey::Method, _withDebugInfo); // new stack frame writer.appendNode(BuildKey::OpenFrame); - ObjectInfo retVal = { ObjectKind::Object, { nestedRef }, 0 }; + // create a state machine enumerator + int preservedContext = 0; + expression.compileNestedInitializing(smScope, nestedRef, preservedContext, nullptr); - int preservedClosure = 0; - expression.compileNestedInitializing(smScope, nestedRef, preservedClosure, nullptr); + ObjectInfo retVal = { ObjectKind::Object, { nestedRef }, 0 }; retVal = expression.saveToTempLocal(retVal); @@ -8581,6 +8733,23 @@ void Compiler :: compileAsyncMethod(BuildTreeWriter& writer, MethodScope& scope, expression.compileAssigning(node, contextField, { ObjectKind::Object }, true); + // invoke state machine enumerator "proceed" routine + ArgumentsInfo args; + args.add(mapClassSymbol(scope, baseRef)); + args.add(retVal); + + mssg_t weakMessage = encodeMessage(scope.module->mapAction(PROCEED_MESSAGE, 0, false), 2, 0); + + int resolvedNillableArgs = 0; + MessageResolution resolution = _logic->resolveSingleDispatch(*scope.moduleScope, + retrieveType(scope, args[0]), weakMessage, false, resolvedNillableArgs); + if (resolution.message) + resolution.resolved = true; + + retVal = expression.compileMessageOperation(node, args[0], resolution, + 0, args, EAttr::None, nullptr); + + // return a result expression.compileConverting(node, retVal, scope.info.outputRef, scope.checkHint(MethodHint::Stacksafe)); @@ -8589,20 +8758,16 @@ void Compiler :: compileAsyncMethod(BuildTreeWriter& writer, MethodScope& scope, writer.appendNode(BuildKey::CloseFrame); endMethod(writer, scope); -*/ - - - assert(false); } -void Compiler::compileYieldMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node) +void Compiler :: compileYieldMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node) { CodeScope codeScope(&scope); Expression expression(this, codeScope, writer); // create yield state machine ref_t nestedRef = scope.moduleScope->mapAnonymous(); - StatemachineClassScope smScope(&expression.scope, nestedRef); + StatemachineClassScope smScope(&expression.scope, nestedRef, false); smScope.typeRef = resolveYieldType(scope, node); BuildNode buildNode = writer.CurrentNode(); @@ -8610,7 +8775,8 @@ void Compiler::compileYieldMethod(BuildTreeWriter& writer, MethodScope& scope, S buildNode = buildNode.parentNode(); BuildTreeWriter nestedWriter(buildNode); - compileStatemachineClass(nestedWriter, smScope, node); + compileStatemachineClass(nestedWriter, smScope, node, + resolveStateMachine(scope, scope.moduleScope->buildins.yielditTemplateReference, smScope.typeRef)); beginMethod(writer, scope, node, BuildKey::Method, _withDebugInfo); @@ -8619,8 +8785,8 @@ void Compiler::compileYieldMethod(BuildTreeWriter& writer, MethodScope& scope, S ObjectInfo retVal = { ObjectKind::Object, { nestedRef }, 0 }; - int preservedClosure = 0; - expression.compileNestedInitializing(smScope, nestedRef, preservedClosure, nullptr); + int preservedContext = 0; + expression.compileNestedInitializing(smScope, nestedRef, preservedContext, nullptr); retVal = expression.saveToTempLocal(retVal); @@ -8798,31 +8964,31 @@ void Compiler::compileConstructorCode(BuildTreeWriter& writer, SyntaxNode node, } switch (current.key) { - case SyntaxKey::ResendDispatch: - // implicit default constructor cannot have redirect statement - because it leads to calling itself - if (scope.message == scope.moduleScope->buildins.constructor_message || scope.message == scope.moduleScope->buildins.protected_constructor_message) - scope.raiseError(errInvalidOperation, node); - case SyntaxKey::CodeBlock: - compileMethodCode(writer, &classClassScope, scope, codeScope, node, newFrame); - break; - case SyntaxKey::ReturnExpression: - compileRetExpression(writer, codeScope, current, EAttr::DynamicObject); - writer.appendNode(BuildKey::CloseFrame); - break; - case SyntaxKey::DirectResend: - compileDirectResendCode(writer, codeScope, current); - break; - case SyntaxKey::Redirect: - // redirect is not allowed for the constructor - scope.raiseError(errInvalidOperation, node); - break; - case SyntaxKey::None: - if (isDefConvConstructor && !test(classFlags, elDynamicRole)) { + case SyntaxKey::ResendDispatch: + // implicit default constructor cannot have redirect statement - because it leads to calling itself + if (scope.message == scope.moduleScope->buildins.constructor_message || scope.message == scope.moduleScope->buildins.protected_constructor_message) + scope.raiseError(errInvalidOperation, node); + case SyntaxKey::CodeBlock: + compileMethodCode(writer, &classClassScope, scope, codeScope, node, newFrame); + break; + case SyntaxKey::ReturnExpression: + compileRetExpression(writer, codeScope, current, EAttr::DynamicObject); writer.appendNode(BuildKey::CloseFrame); break; - } - default: - throw InternalError(errFatalError); + case SyntaxKey::DirectResend: + compileDirectResendCode(writer, codeScope, current); + break; + case SyntaxKey::Redirect: + // redirect is not allowed for the constructor + scope.raiseError(errInvalidOperation, node); + break; + case SyntaxKey::None: + if (isDefConvConstructor && !test(classFlags, elDynamicRole)) { + writer.appendNode(BuildKey::CloseFrame); + break; + } + default: + throw InternalError(errFatalError); } } @@ -8830,7 +8996,7 @@ void Compiler::compileConstructor(BuildTreeWriter& writer, MethodScope& scope, ClassScope& classClassScope, SyntaxNode node, bool abstractMode) { bool isProtectedDefConst = false; - bool isDefConvConstructor = isDefaultOrConversionConstructor(scope, scope.message, scope.checkHint(MethodHint::Internal), isProtectedDefConst); + bool isDefConvConstructor = isDefaultOrConversionConstructor(scope, scope.message, MethodInfo::checkVisibility(scope.info, MethodHint::Internal), isProtectedDefConst); mssg_t defConstrMssg = scope.moduleScope->buildins.constructor_message; mssg_t protectedDefConstructor = classClassScope.getMssgAttribute(defConstrMssg, ClassAttribute::ProtectedAlias); @@ -8948,7 +9114,7 @@ void Compiler::initializeMethod(ClassScope& scope, MethodScope& methodScope, Syn methodScope.targetSelfMode = methodScope.checkHint(MethodHint::TargetSelf); methodScope.nestedMode = scope.getScope(Scope::ScopeLevel::OwnerClass) != &scope; - declareVMTMessage(methodScope, current, false, false); + declareVMTMessage(methodScope, current, false, false, false); if (methodScope.info.outputRef) { SyntaxNode typeNode = current.findChild(SyntaxKey::Type, SyntaxKey::ArrayType, SyntaxKey::TemplateType); @@ -9231,12 +9397,12 @@ void Compiler::compileIteratorMethod(BuildTreeWriter& writer, MethodScope& scope SyntaxNode current = node.firstChild(SyntaxKey::MemberMask); switch (current.key) { - case SyntaxKey::CodeBlock: - case SyntaxKey::ReturnExpression: - compileMethodCode(writer, classScope, scope, codeScope, node, false); - break; - default: - break; + case SyntaxKey::CodeBlock: + case SyntaxKey::ReturnExpression: + compileMethodCode(writer, classScope, scope, codeScope, node, false); + break; + default: + break; } codeScope.syncStack(&scope); @@ -9249,10 +9415,8 @@ void Compiler::compileIteratorMethod(BuildTreeWriter& writer, MethodScope& scope checkUnassignedVariables(scope, node); } -void Compiler::compileStatemachineClass(BuildTreeWriter& writer, StatemachineClassScope& scope, SyntaxNode node) +void Compiler :: compileStatemachineClass(BuildTreeWriter& writer, StatemachineClassScope& scope, SyntaxNode node, ref_t parentRef) { - ref_t parentRef = resolveStateMachine(scope, scope.moduleScope->buildins.yielditTemplateReference, scope.typeRef); - declareClassParent(parentRef, scope, node); generateClassFlags(scope, elNestedClass | elSealed); @@ -9298,37 +9462,37 @@ void Compiler::compileVMT(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::HasStaticConstructor: - scope.withStaticConstructor = true; - break; - case SyntaxKey::Method: - { - if (exclusiveMode - && (ignoreAutoMultimethod == SyntaxTree::ifChildExists(current, SyntaxKey::Autogenerated, -1))) + case SyntaxKey::HasStaticConstructor: + scope.withStaticConstructor = true; + break; + case SyntaxKey::Method: { - current = current.nextNode(); - continue; - } + if (exclusiveMode + && (ignoreAutoMultimethod == SyntaxTree::ifChildExists(current, SyntaxKey::Autogenerated, -1))) + { + current = current.nextNode(); + continue; + } - Method method(this, scope); - method.compile(writer, current); - break; - } - case SyntaxKey::Constructor: - if (_logic->isRole(scope.info)) { - scope.raiseError(errIllegalConstructor, node); - } - break; - case SyntaxKey::StaticMethod: - if (_logic->isRole(scope.info)) { - scope.raiseError(errIllegalStaticMethod, node); + Method method(this, scope); + method.compile(writer, current); + break; } - break; - case SyntaxKey::StaticInitializerMethod: - compileStaticInitializerMethod(writer, scope, current); - break; - default: - break; + case SyntaxKey::Constructor: + if (_logic->isRole(scope.info)) { + scope.raiseError(errIllegalConstructor, node); + } + break; + case SyntaxKey::StaticMethod: + if (_logic->isRole(scope.info)) { + scope.raiseError(errIllegalStaticMethod, node); + } + break; + case SyntaxKey::StaticInitializerMethod: + compileStaticInitializerMethod(writer, scope, current); + break; + default: + break; } current = current.nextNode(); @@ -9342,20 +9506,20 @@ void Compiler::compileVMT(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode } } -void Compiler::compileClassVMT(BuildTreeWriter& writer, ClassScope& classClassScope, ClassScope& scope, SyntaxNode node) +void Compiler :: compileClassVMT(BuildTreeWriter& writer, ClassScope& classClassScope, ClassScope& scope, SyntaxNode node) { SyntaxNode current = node.firstChild(); // first pass - compile constructors while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Constructor: - { - Method method(this, scope); - method.compileConstructor(writer, current, classClassScope); - break; - } - default: - break; + case SyntaxKey::Constructor: + { + Method method(this, scope); + method.compileConstructor(writer, current, classClassScope); + break; + } + default: + break; } current = current.nextNode(); } @@ -9364,27 +9528,30 @@ void Compiler::compileClassVMT(BuildTreeWriter& writer, ClassScope& classClassSc current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::StaticMethod: - { - MethodScope methodScope(&classClassScope); - initializeMethod(classClassScope, methodScope, current); + case SyntaxKey::StaticMethod: + { + MethodScope methodScope(&classClassScope); + initializeMethod(classClassScope, methodScope, current); -#ifdef FULL_OUTOUT_INFO - IdentifierString messageName; - ByteCodeUtil::resolveMessageName(messageName, scope.module, methodScope.message); + #ifdef FULL_OUTOUT_INFO + IdentifierString messageName; + ByteCodeUtil::resolveMessageName(messageName, scope.module, methodScope.message); - _errorProcessor->info(infoCurrentMethod, *messageName); -#endif // FULL_OUTOUT_INFO + _errorProcessor->info(infoCurrentMethod, *messageName); + #endif // FULL_OUTOUT_INFO - if (methodScope.isYieldable()) { - compileYieldMethod(writer, methodScope, current); - } - else compileMethod(writer, methodScope, current); + if (methodScope.isYieldable()) { + compileYieldMethod(writer, methodScope, current); + } + else if (methodScope.checkHint(MethodHint::Async)) { + compileAsyncMethod(writer, methodScope, current); + } + else compileMethod(writer, methodScope, current); - break; - } - default: - break; + break; + } + default: + break; } current = current.nextNode(); } @@ -9487,7 +9654,7 @@ bool Compiler::isProxy(Scope& scope, SyntaxNode node) return true; } -void Compiler::compileNestedClass(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode node, ref_t parentRef) +void Compiler :: compileNestedClass(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode node, ref_t parentRef) { NamespaceScope* ns = Scope::getScope(scope, Scope::ScopeLevel::Namespace); scope.info.header.flags |= elNestedClass; @@ -9497,12 +9664,12 @@ void Compiler::compileNestedClass(BuildTreeWriter& writer, ClassScope& scope, Sy SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Field: - case SyntaxKey::Method: - virtualClass = false; - break; - default: - break; + case SyntaxKey::Field: + case SyntaxKey::Method: + virtualClass = false; + break; + default: + break; } current = current.nextNode(); @@ -9640,52 +9807,55 @@ void Compiler::compileNamespace(BuildTreeWriter& writer, NamespaceScope& ns, Syn SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::SourcePath: - ns.sourcePath.copy(current.identifier()); - break; - case SyntaxKey::Namespace: - { - Namespace subNs(this, &ns); - subNs.declareNamespace(current, false, false); - copyParentNamespaceExtensions(ns, subNs.scope); + case SyntaxKey::SourcePath: + ns.sourcePath.copy(current.identifier()); + break; + case SyntaxKey::Namespace: + { + Namespace subNs(this, &ns); + subNs.declareNamespace(current, false, false); + copyParentNamespaceExtensions(ns, subNs.scope); - compileNamespace(writer, subNs.scope, current); - break; - } - case SyntaxKey::Symbol: - { - SymbolScope symbolScope(&ns, current.arg.reference, ns.defaultVisibility); - if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_STATIC)) { - symbolScope.type = SymbolKind::Static; - } - else if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_THREADVAR)) { - symbolScope.type = SymbolKind::ThreadVar; + compileNamespace(writer, subNs.scope, current); + break; } + case SyntaxKey::Symbol: + { + SymbolScope symbolScope(&ns, current.arg.reference, ns.defaultVisibility); + if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_STATIC)) { + symbolScope.type = SymbolKind::Static; + } + else if (SyntaxTree::ifChildExists(current, SyntaxKey::Attribute, V_THREADVAR)) { + symbolScope.type = SymbolKind::ThreadVar; + } - symbolScope.visibility = ns.moduleScope->retrieveVisibility(symbolScope.reference); + symbolScope.visibility = ns.moduleScope->retrieveVisibility(symbolScope.reference); - compileSymbol(writer, symbolScope, current); - break; - } - case SyntaxKey::Class: - { - Class classHelper(this, &ns, current.arg.reference, ns.defaultVisibility); - classHelper.load(); + compileSymbol(writer, symbolScope, current); + break; + } + case SyntaxKey::Class: + { + Class classHelper(this, &ns, current.arg.reference, ns.defaultVisibility); + classHelper.load(); - compileClass(writer, classHelper.scope, current); + compileClass(writer, classHelper.scope, current); - // compile class class if it available - if (classHelper.scope.info.header.classRef != classHelper.scope.reference && classHelper.scope.info.header.classRef != 0) { - ClassClassScope classClassScope(&ns, classHelper.scope.info.header.classRef, classHelper.scope.visibility, &classHelper.scope.info, classHelper.scope.reference); - ns.moduleScope->loadClassInfo(classClassScope.info, classClassScope.reference, false); + // compile class class if it available + if (classHelper.scope.info.header.classRef != classHelper.scope.reference && classHelper.scope.info.header.classRef != 0) { + ClassClassScope classClassScope(&ns, classHelper.scope.info.header.classRef, classHelper.scope.visibility, &classHelper.scope.info, classHelper.scope.reference); + ns.moduleScope->loadClassInfo(classClassScope.info, classClassScope.reference, false); - compileClassClass(writer, classClassScope, classHelper.scope, current); + if (test(classHelper.scope.info.header.flags, elTemplatebased)) + classClassScope.info.header.flags |= elTemplatebased; + + compileClassClass(writer, classClassScope, classHelper.scope, current); + } + break; } - break; - } - default: - // to make compiler happy - break; + default: + // to make compiler happy + break; } current = current.nextNode(); @@ -9794,9 +9964,11 @@ void Compiler::prepare(ModuleScopeBase* moduleScope, ForwardResolverBase* forwar moduleScope->buildins.closureTemplateReference = safeMapWeakReference(moduleScope, forwardResolver, CLOSURE_FORWARD); moduleScope->buildins.tupleTemplateReference = safeMapWeakReference(moduleScope, forwardResolver, TUPLE_FORWARD); moduleScope->buildins.yielditTemplateReference = safeMapWeakReference(moduleScope, forwardResolver, YIELDIT_FORWARD); + moduleScope->buildins.asyncStatemachineReference = safeMapWeakReference(moduleScope, forwardResolver, ASYNCIT_FORWARD); moduleScope->buildins.lazyExpressionReference = safeMapWeakReference(moduleScope, forwardResolver, LAZY_FORWARD); moduleScope->buildins.uintReference = safeMapReference(moduleScope, forwardResolver, UINT_FORWARD); moduleScope->buildins.pointerReference = safeMapReference(moduleScope, forwardResolver, PTR_FORWARD); + moduleScope->buildins.taskReference = safeMapReference(moduleScope, forwardResolver, TASK_FORWARD); moduleScope->branchingInfo.typeRef = safeMapReference(moduleScope, forwardResolver, BOOL_FORWARD); moduleScope->branchingInfo.trueRef = safeMapReference(moduleScope, forwardResolver, TRUE_FORWARD); @@ -10079,41 +10251,6 @@ inline SyntaxNode newVirtualMethod(SyntaxNode classNode, SyntaxKey methodType, m return methodNode; } -void Compiler::injectVirtualEmbeddableWrapper(SyntaxNode classNode, SyntaxKey methodType, - ref_t targetRef, ClassInfo& info, mssg_t message, bool abstractOne) -{ - MethodInfo methodInfo = {}; - - auto m_it = info.methods.getIt(message); - bool found = !m_it.eof(); - if (found) - methodInfo = *m_it; - - if (!found || methodInfo.inherited) { - Visibility visibility = Visibility::Public; - if (MethodScope::checkHint(methodInfo, MethodHint::Internal)) { - visibility = Visibility::Internal; - } - else if (MethodScope::checkHint(methodInfo, MethodHint::Protected)) { - visibility = Visibility::Protected; - } - else if (MethodScope::checkHint(methodInfo, MethodHint::Private)) { - visibility = Visibility::Private; - } - - SyntaxNode methodNode = newVirtualMethod(classNode, methodType, message, visibility, abstractOne); - methodNode.appendChild(SyntaxKey::Autogenerated, -1); // -1 indicates autogenerated method - - if (!abstractOne) { - mssg_t resendMessage = message | STATIC_MESSAGE; - - SyntaxNode resendOp = methodNode.appendChild(SyntaxKey::DirectResend, resendMessage); - resendOp.appendChild(SyntaxKey::Target, targetRef); - } - else methodNode.appendChild(SyntaxKey::WithoutBody); - } -} - inline bool isSingleDispatch(SyntaxNode node, SyntaxKey methodType, mssg_t message, mssg_t& targetMessage) { // !! currently constructor is not supporting single dispatch operation @@ -10418,22 +10555,25 @@ void Compiler::injectVirtualReturningMethod(Scope& scope, SyntaxNode classNode, exprNode.appendChild(SyntaxKey::Object).appendChild(SyntaxKey::identifier, retVar); } -void Compiler::generateOverloadListMember(ModuleScopeBase& scope, ref_t listRef, ref_t classRef, +void Compiler :: generateOverloadListMember(ModuleScopeBase& scope, ref_t listRef, ref_t classRef, mssg_t messageRef, MethodHint type) { MemoryWriter metaWriter(scope.module->mapSection(listRef | mskConstArray, false)); if (metaWriter.position() == 0) { metaWriter.writeDReference(0, messageRef); switch (type) { - case MethodHint::Sealed: - metaWriter.writeDReference(classRef | mskVMTMethodAddress, messageRef); - break; - case MethodHint::Virtual: - metaWriter.writeDReference(classRef | mskVMTMethodOffset, messageRef); - break; - default: - metaWriter.writeDWord(0); - break; + case MethodHint::Sealed: + metaWriter.writeDReference(classRef | mskVMTMethodAddress, messageRef); + break; + case MethodHint::Fixed: + metaWriter.writeDReference(classRef | mskVMTMethodOffset, messageRef); + break; + case MethodHint::ByIndex: + metaWriter.writeDReference(classRef | mskHMTMethodOffset, messageRef); + break; + default: + metaWriter.writeDWord(0); + break; } metaWriter.writeDWord(0); } @@ -10446,13 +10586,16 @@ void Compiler::generateOverloadListMember(ModuleScopeBase& scope, ref_t listRef, metaWriter.insertDWord(0, messageRef); metaWriter.Memory()->addReference(0, 0); switch (type) { - case MethodHint::Sealed: - metaWriter.Memory()->addReference(classRef | mskVMTMethodAddress, 4); - break; - case MethodHint::Virtual: - metaWriter.Memory()->addReference(classRef | mskVMTMethodOffset, 4); - break; - default: + case MethodHint::Sealed: + metaWriter.Memory()->addReference(classRef | mskVMTMethodAddress, 4); + break; + case MethodHint::Fixed: + metaWriter.Memory()->addReference(classRef | mskVMTMethodOffset, 4); + break; + case MethodHint::ByIndex: + metaWriter.Memory()->addReference(classRef | mskHMTMethodOffset, 4); + break; + default: break; } } @@ -10629,7 +10772,7 @@ void Compiler::declareModuleExtensionDispatcher(NamespaceScope& scope, SyntaxNod mssg_t genericMessage = *g_it; _logic->injectMethodOverloadList(this, *scope.moduleScope, - classScope.info.header.flags, genericMessage | FUNCTION_MESSAGE, methods, + MethodHint::Sealed, genericMessage | FUNCTION_MESSAGE, methods, classScope.info.attributes, &targets, targetResolver, ClassAttribute::ExtOverloadList); } @@ -10973,44 +11116,44 @@ void Compiler::Class::resolveClassPostfixes(SyntaxNode node, bool extensionMode) SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::InlineTemplate: - if (!compiler->importInlineTemplate(scope, current, INLINE_PREFIX, node)) - scope.raiseError(errInvalidOperation, current); - break; - case SyntaxKey::Parent: - { - SyntaxNode child = current.firstChild(); - if (child == SyntaxKey::TemplateType) { - if (compiler->importTemplate(scope, child, node, true)) { - // try to import as weak template + case SyntaxKey::InlineTemplate: + if (!compiler->importInlineTemplate(scope, current, INLINE_PREFIX, node)) + scope.raiseError(errInvalidOperation, current); + break; + case SyntaxKey::Parent: + { + SyntaxNode child = current.firstChild(); + if (child == SyntaxKey::TemplateType) { + if (compiler->importTemplate(scope, child, node, true)) { + // try to import as weak template + } + else if (!parentRef) { + parentNode = current; + + parentRef = compiler->resolveStrongTypeAttribute(scope, child, extensionMode, false).typeRef; + } + else if (!compiler->importTemplate(scope, child, node, false)) + scope.raiseError(errUnknownTemplate, current); + } + else if (child == SyntaxKey::EnumPostfix) { + if (!compiler->importEnumTemplate(scope, child, node)) + scope.raiseError(errUnknownTemplate, current); } else if (!parentRef) { parentNode = current; parentRef = compiler->resolveStrongTypeAttribute(scope, child, extensionMode, false).typeRef; } - else if (!compiler->importTemplate(scope, child, node, false)) - scope.raiseError(errUnknownTemplate, current); - } - else if (child == SyntaxKey::EnumPostfix) { - if (!compiler->importEnumTemplate(scope, child, node)) - scope.raiseError(errUnknownTemplate, current); - } - else if (!parentRef) { - parentNode = current; + else scope.raiseError(errInvalidSyntax, current); - parentRef = compiler->resolveStrongTypeAttribute(scope, child, extensionMode, false).typeRef; + break; } - else scope.raiseError(errInvalidSyntax, current); - - break; - } - case SyntaxKey::IncludeStatement: - if (!compiler->includeBlock(scope, current.firstChild(), node)) - scope.raiseError(errUnknownTemplate, current); - break; - default: - break; + case SyntaxKey::IncludeStatement: + if (!compiler->includeBlock(scope, current.firstChild(), node)) + scope.raiseError(errUnknownTemplate, current); + break; + default: + break; } //else if (!parentRef) { // parentNode = baseNode; @@ -11245,7 +11388,7 @@ ObjectInfo Compiler::Expression::compileRoot(SyntaxNode node, EAttr mode) return retVal; } -ObjectInfo Compiler::Expression::compileReturning(SyntaxNode node, EAttr mode, TypeInfo outputInfo) +ObjectInfo Compiler::Expression :: compileReturning(SyntaxNode node, EAttr mode, TypeInfo outputInfo) { bool dynamicRequired = EAttrs::testAndExclude(mode, EAttr::DynamicObject); @@ -11264,16 +11407,16 @@ ObjectInfo Compiler::Expression::compileReturning(SyntaxNode node, EAttr mode, T ObjectInfo retVal = {}; SyntaxNode exprNode = node.findChild(SyntaxKey::Expression, SyntaxKey::CodeBlock); switch (exprNode.key) { - case SyntaxKey::Expression: - retVal = compile(node.findChild(SyntaxKey::Expression), outputInfo.typeRef, - mode | EAttr::Root | EAttr::RetValExpected, nullptr); - break; - case SyntaxKey::CodeBlock: - retVal = compiler->compileCode(*writer, *codeScope, exprNode, true); - break; - default: - assert(false); - break; + case SyntaxKey::Expression: + retVal = compile(node.findChild(SyntaxKey::Expression), outputInfo.typeRef, + mode | EAttr::Root | EAttr::RetValExpected, nullptr); + break; + case SyntaxKey::CodeBlock: + retVal = compiler->compileCode(*writer, *codeScope, exprNode, true); + break; + default: + assert(false); + break; } if (codeScope->isByRefHandler()) { @@ -11338,167 +11481,167 @@ ObjectInfo Compiler::Expression::compile(SyntaxNode node, ref_t targetRef, EAttr SyntaxNode current = node == SyntaxKey::Expression ? node.firstChild() : node; switch (current.key) { - case SyntaxKey::MessageOperation: - if (lookaheadMode) { - retVal = compileLookAhead(current, targetRef, mode); - } - else retVal = compileMessageOperation(current, targetRef, mode); - break; - case SyntaxKey::PropertyOperation: - if (lookaheadMode) { - retVal = compileLookAhead(current, targetRef, mode); - } - else retVal = compilePropertyOperation(current, targetRef, mode); - break; - case SyntaxKey::AssignOperation: - case SyntaxKey::AddOperation: - case SyntaxKey::SubOperation: - case SyntaxKey::MulOperation: - case SyntaxKey::DivOperation: - case SyntaxKey::LenOperation: - case SyntaxKey::LessOperation: - case SyntaxKey::GreaterOperation: - case SyntaxKey::NameOperation: - case SyntaxKey::EqualOperation: - case SyntaxKey::NotOperation: - case SyntaxKey::NotEqualOperation: - case SyntaxKey::NotLessOperation: - case SyntaxKey::NotGreaterOperation: - case SyntaxKey::NestedExpression: - case SyntaxKey::ValueOperation: - case SyntaxKey::BAndOperation: - case SyntaxKey::BOrOperation: - case SyntaxKey::BXorOperation: - case SyntaxKey::BNotOperation: - case SyntaxKey::ShlOperation: - case SyntaxKey::ShrOperation: - case SyntaxKey::NegateOperation: - retVal = compileOperation(current, (int)current.key - OPERATOR_MAKS, targetRef, mode); - break; - case SyntaxKey::ExprValOperation: - case SyntaxKey::SizeOperation: - retVal = compileEvalOnlySpecialOperation(current); - break; - case SyntaxKey::BreakOperation: - case SyntaxKey::ContinueOperation: - retVal = compileSpecialOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); - break; - case SyntaxKey::AsyncOperation: - compileAsyncOperation(current); - break; - case SyntaxKey::YieldOperation: - compileYieldOperation(current); - break; - case SyntaxKey::AddAssignOperation: - case SyntaxKey::SubAssignOperation: - case SyntaxKey::MulAssignOperation: - case SyntaxKey::DivAssignOperation: - case SyntaxKey::IncOperation: - case SyntaxKey::DecOperation: - retVal = compileAssignOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); - break; - case SyntaxKey::AndOperation: - case SyntaxKey::OrOperation: - retVal = compileBoolOperation(current, (int)current.key - OPERATOR_MAKS); - if (targetRef) - typecastObject(current, retVal, targetRef, EAttrs::test(mode, EAttr::Nillable)); - - break; - case SyntaxKey::IndexerOperation: - retVal = compileIndexerOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); - break; - case SyntaxKey::IfOperation: - case SyntaxKey::IfNotOperation: - case SyntaxKey::IfElseOperation: - retVal = compileBranchingOperation(current, (int)current.key - OPERATOR_MAKS, - EAttrs::test(mode, EAttr::RetValExpected), EAttrs::test(mode, EAttr::NoDebugInfo)); - break; - case SyntaxKey::BranchOperation: - // HOTFIX : used for script based code - retVal = compileBranchingOperation(current, - (current.firstChild().nextNode().nextNode() != SyntaxKey::None ? IF_ELSE_OPERATOR_ID : IF_OPERATOR_ID), - EAttrs::test(mode, EAttr::RetValExpected), false); - break; - case SyntaxKey::LoopOperation: - retVal = compileLoop(current.firstChild(), mode); - break; - case SyntaxKey::ExternOperation: - retVal = compileExtern(current.firstChild(), mode); - break; - case SyntaxKey::CatchOperation: - retVal = compileCatchOperation(current); - break; - case SyntaxKey::FinalOperation: - retVal = compileFinalOperation(current); - break; - case SyntaxKey::AltOperation: - retVal = compileAltOperation(current); - break; - case SyntaxKey::IsNilOperation: - retVal = compileIsNilOperation(current); - break; - case SyntaxKey::ReturnExpression: - retVal = compile(current.firstChild(), 0, mode, updatedOuterArgs); - break; - case SyntaxKey::Expression: - retVal = compile(current, targetRef, mode, updatedOuterArgs); - targetRef = 0; - break; - case SyntaxKey::Object: - retVal = compileObject(current, mode, updatedOuterArgs); - break; - case SyntaxKey::NestedBlock: - retVal = compileNested(current, mode, updatedOuterArgs); - break; - case SyntaxKey::ClosureBlock: - retVal = compileClosure(current, targetRef, mode, updatedOuterArgs); - break; - case SyntaxKey::LazyOperation: - retVal = compileClosure(current, 0, mode, updatedOuterArgs); - break; - case SyntaxKey::CodeBlock: - retVal = compileSubCode(current, mode, true); - break; - case SyntaxKey::SwitchOperation: - compileSwitchOperation(current); - break; - case SyntaxKey::CollectionExpression: - retVal = compileCollection(current, mode); - break; - case SyntaxKey::KeyValueExpression: - retVal = compileKeyValue(current, mode); - break; - case SyntaxKey::Type: - case SyntaxKey::ReferOperation: - scope.raiseError(errInvalidOperation, node); - break; - case SyntaxKey::Attribute: - { - EAttrs exprAttr = mode; - if (!compiler->_logic->validateExpressionAttribute(current.arg.reference, exprAttr)) - scope.raiseError(errInvalidHint, current);; + case SyntaxKey::MessageOperation: + if (lookaheadMode) { + retVal = compileLookAhead(current, targetRef, mode); + } + else retVal = compileMessageOperation(current, targetRef, mode); + break; + case SyntaxKey::PropertyOperation: + if (lookaheadMode) { + retVal = compileLookAhead(current, targetRef, mode); + } + else retVal = compilePropertyOperation(current, targetRef, mode); + break; + case SyntaxKey::AssignOperation: + case SyntaxKey::AddOperation: + case SyntaxKey::SubOperation: + case SyntaxKey::MulOperation: + case SyntaxKey::DivOperation: + case SyntaxKey::LenOperation: + case SyntaxKey::LessOperation: + case SyntaxKey::GreaterOperation: + case SyntaxKey::NameOperation: + case SyntaxKey::EqualOperation: + case SyntaxKey::NotOperation: + case SyntaxKey::NotEqualOperation: + case SyntaxKey::NotLessOperation: + case SyntaxKey::NotGreaterOperation: + case SyntaxKey::NestedExpression: + case SyntaxKey::ValueOperation: + case SyntaxKey::BAndOperation: + case SyntaxKey::BOrOperation: + case SyntaxKey::BXorOperation: + case SyntaxKey::BNotOperation: + case SyntaxKey::ShlOperation: + case SyntaxKey::ShrOperation: + case SyntaxKey::NegateOperation: + retVal = compileOperation(current, (int)current.key - OPERATOR_MAKS, targetRef, mode); + break; + case SyntaxKey::ExprValOperation: + case SyntaxKey::SizeOperation: + retVal = compileEvalOnlySpecialOperation(current); + break; + case SyntaxKey::BreakOperation: + case SyntaxKey::ContinueOperation: + retVal = compileSpecialOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); + break; + case SyntaxKey::AsyncOperation: + compileAsyncOperation(current, paramMode || targetRef != 0); + break; + case SyntaxKey::YieldOperation: + compileYieldOperation(current); + break; + case SyntaxKey::AddAssignOperation: + case SyntaxKey::SubAssignOperation: + case SyntaxKey::MulAssignOperation: + case SyntaxKey::DivAssignOperation: + case SyntaxKey::IncOperation: + case SyntaxKey::DecOperation: + retVal = compileAssignOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); + break; + case SyntaxKey::AndOperation: + case SyntaxKey::OrOperation: + retVal = compileBoolOperation(current, (int)current.key - OPERATOR_MAKS); + if (targetRef) + typecastObject(current, retVal, targetRef, EAttrs::test(mode, EAttr::Nillable)); + + break; + case SyntaxKey::IndexerOperation: + retVal = compileIndexerOperation(current, (int)current.key - OPERATOR_MAKS, targetRef); + break; + case SyntaxKey::IfOperation: + case SyntaxKey::IfNotOperation: + case SyntaxKey::IfElseOperation: + retVal = compileBranchingOperation(current, (int)current.key - OPERATOR_MAKS, + EAttrs::test(mode, EAttr::RetValExpected), EAttrs::test(mode, EAttr::NoDebugInfo)); + break; + case SyntaxKey::BranchOperation: + // HOTFIX : used for script based code + retVal = compileBranchingOperation(current, + (current.firstChild().nextNode().nextNode() != SyntaxKey::None ? IF_ELSE_OPERATOR_ID : IF_OPERATOR_ID), + EAttrs::test(mode, EAttr::RetValExpected), false); + break; + case SyntaxKey::LoopOperation: + retVal = compileLoop(current.firstChild(), mode); + break; + case SyntaxKey::ExternOperation: + retVal = compileExtern(current.firstChild(), mode); + break; + case SyntaxKey::CatchOperation: + retVal = compileCatchOperation(current); + break; + case SyntaxKey::FinalOperation: + retVal = compileFinalOperation(current); + break; + case SyntaxKey::AltOperation: + retVal = compileAltOperation(current); + break; + case SyntaxKey::IsNilOperation: + retVal = compileIsNilOperation(current); + break; + case SyntaxKey::ReturnExpression: + retVal = compile(current.firstChild(), 0, mode, updatedOuterArgs); + break; + case SyntaxKey::Expression: + retVal = compile(current, targetRef, mode, updatedOuterArgs); + targetRef = 0; + break; + case SyntaxKey::Object: + retVal = compileObject(current, mode, updatedOuterArgs); + break; + case SyntaxKey::NestedBlock: + retVal = compileNested(current, mode, updatedOuterArgs); + break; + case SyntaxKey::ClosureBlock: + retVal = compileClosure(current, targetRef, mode, updatedOuterArgs); + break; + case SyntaxKey::LazyOperation: + retVal = compileClosure(current, 0, mode, updatedOuterArgs); + break; + case SyntaxKey::CodeBlock: + retVal = compileSubCode(current, mode, true); + break; + case SyntaxKey::SwitchOperation: + compileSwitchOperation(current); + break; + case SyntaxKey::CollectionExpression: + retVal = compileCollection(current, mode); + break; + case SyntaxKey::KeyValueExpression: + retVal = compileKeyValue(current, mode); + break; + case SyntaxKey::Type: + case SyntaxKey::ReferOperation: + scope.raiseError(errInvalidOperation, node); + break; + case SyntaxKey::Attribute: + { + EAttrs exprAttr = mode; + if (!compiler->_logic->validateExpressionAttribute(current.arg.reference, exprAttr)) + scope.raiseError(errInvalidHint, current);; - return compile(current.nextNode(), targetRef, exprAttr.attrs, updatedOuterArgs); - break; - } - case SyntaxKey::TupleCollection: - retVal = compileTupleCollection(current, targetRef); - break; - case SyntaxKey::TupleAssignOperation: - retVal = compileTupleAssigning(current); - break; - case SyntaxKey::ClosureOperation: - retVal = compileClosureOperation(current, targetRef); - break; - case SyntaxKey::Interpolation: - retVal = compileInterpolation(current); - break; - case SyntaxKey::None: - assert(false); - break; - default: - retVal = compileObject(node, mode, updatedOuterArgs); - break; + return compile(current.nextNode(), targetRef, exprAttr.attrs, updatedOuterArgs); + break; + } + case SyntaxKey::TupleCollection: + retVal = compileTupleCollection(current, targetRef); + break; + case SyntaxKey::TupleAssignOperation: + retVal = compileTupleAssigning(current); + break; + case SyntaxKey::ClosureOperation: + retVal = compileClosureOperation(current, targetRef); + break; + case SyntaxKey::Interpolation: + retVal = compileInterpolation(current); + break; + case SyntaxKey::None: + assert(false); + break; + default: + retVal = compileObject(node, mode, updatedOuterArgs); + break; } retVal = validateObject(node, retVal, targetRef, @@ -11540,24 +11683,24 @@ ObjectInfo Compiler::Expression::compileInterpolation(SyntaxNode node) return compileMessageOperation(node, source, messageRef, 0, arguments, EAttr::StrongResolved | EAttr::NoExtension, nullptr); } -ObjectInfo Compiler::Expression::compileObject(SyntaxNode node, ExpressionAttribute mode, ArgumentsInfo* updatedOuterArgs) +ObjectInfo Compiler::Expression :: compileObject(SyntaxNode node, ExpressionAttribute mode, ArgumentsInfo* updatedOuterArgs) { if (node == SyntaxKey::Object) { ObjectInfo retVal = compiler->mapObject(scope, node, mode); switch (retVal.kind) { - case ObjectKind::ConstantLiteral: - { - ArgumentsInfo arguments; - ref_t typeRef = scope.moduleScope->buildins.literalReference; - ref_t signRef = scope.module->mapSignature(&typeRef, 1, false); + case ObjectKind::ConstantLiteral: + { + ArgumentsInfo arguments; + ref_t typeRef = scope.moduleScope->buildins.literalReference; + ref_t signRef = scope.module->mapSignature(&typeRef, 1, false); - return compileNewOp(node, retVal, signRef, arguments); - } - case ObjectKind::Unknown: - scope.raiseError(errUnknownObject, node.lastChild(SyntaxKey::TerminalMask)); - break; - default: - break; + return compileNewOp(node, retVal, signRef, arguments); + } + case ObjectKind::Unknown: + scope.raiseError(errUnknownObject, node.lastChild(SyntaxKey::TerminalMask)); + break; + default: + break; } return retVal; @@ -11572,15 +11715,15 @@ ObjectInfo Compiler::Expression::compileLookAhead(SyntaxNode node, ref_t targetR ObjectInfo retVal; switch (node.key) { - case SyntaxKey::MessageOperation: - retVal = compileMessageOperation(node, targetRef, mode); - break; - case SyntaxKey::PropertyOperation: - retVal = compilePropertyOperation(node, targetRef, mode); - break; - default: - assert(false); - break; + case SyntaxKey::MessageOperation: + retVal = compileMessageOperation(node, targetRef, mode); + break; + case SyntaxKey::PropertyOperation: + retVal = compilePropertyOperation(node, targetRef, mode); + break; + default: + assert(false); + break; } if (!targetRef && compiler->_logic->isEmbeddable(*scope.moduleScope, retVal.typeInfo.typeRef)) { @@ -11594,22 +11737,67 @@ ObjectInfo Compiler::Expression::compileLookAhead(SyntaxNode node, ref_t targetR } switch (node.key) { - case SyntaxKey::MessageOperation: - retVal = compileMessageOperation(node, targetRef, mode); + case SyntaxKey::MessageOperation: + retVal = compileMessageOperation(node, targetRef, mode); + break; + case SyntaxKey::PropertyOperation: + retVal = compilePropertyOperation(node, targetRef, mode); + break; + default: + assert(false); + break; + } + } + + return retVal; +} + +bool Compiler::Expression :: checkValidity(ObjectInfo target, MessageResolution& resolution, bool allowPrivateCall) +{ + ref_t targetRef = resolution.extensionRef ? resolution.extensionRef : compiler->resolveStrongType(scope, target.typeInfo); + + CheckMethodResult result = {}; + if (compiler->_logic->checkMethod(*scope.moduleScope, targetRef, resolution.message, result)) { + return checkValidity(target, result, allowPrivateCall); + } + + return false; +} + +bool Compiler::Expression :: checkValidity(ObjectInfo target, CheckMethodResult& result, bool allowPrivateCall) +{ + switch (result.visibility) { + case Visibility::Private: + if (allowPrivateCall || isSelfCall(target) || isClassClassOperation(scope, target)) { + return true; + } break; - case SyntaxKey::PropertyOperation: - retVal = compilePropertyOperation(node, targetRef, mode); + case Visibility::Protected: + if (isSelfCall(target) || target.kind == ObjectKind::SuperLocal) { + return true; + } + break; + case Visibility::Internal: + if (compiler->_logic->isInternalOp(*scope.moduleScope, compiler->resolveStrongType(scope, target.typeInfo))) { + return true; + } + if (test(scope.getClassFlags(), elTemplatebased) + && compiler->_logic->isTemplateInternalOp(*scope.moduleScope, scope.getClassRef(), + compiler->resolveStrongType(scope, target.typeInfo))) + { + return true; + } break; + case Visibility::Public: + return true; default: - assert(false); break; - } } - return retVal; + return false; } -ObjectInfo Compiler::Expression::compileMessageOperationR(SyntaxNode node, SyntaxNode messageNode, ObjectInfo source, ArgumentsInfo& arguments, +ObjectInfo Compiler::Expression :: compileMessageOperationR(SyntaxNode node, SyntaxNode messageNode, ObjectInfo source, ArgumentsInfo& arguments, ArgumentsInfo* updatedOuterArgs, ref_t expectedRef, bool propertyMode, bool probeMode, bool ignoreVariadics, ExpressionAttribute attrs) { ObjectInfo retVal = {}; @@ -11657,7 +11845,7 @@ ObjectInfo Compiler::Expression::compileMessageOperationR(SyntaxNode node, Synta auto byRefResolution = resolveByRefHandler(source, expectedRef, messageRef, implicitSignatureRef, EAttrs::test(attrs, EAttr::NoExtension)); - if (byRefResolution.resolved) { + if (byRefResolution.resolved && checkValidity(source, byRefResolution, false)) { ObjectInfo tempRetVal = declareTempLocal(expectedRef, false); addOutRetVal(arguments, tempRetVal); @@ -11733,53 +11921,53 @@ ObjectInfo Compiler::Expression::compileMessageOperation(SyntaxNode node, bool probeMode = source.mode == TargetMode::Probe; switch (source.mode) { - case TargetMode::External: - case TargetMode::WinApi: - { - compileMessageArguments(current, arguments, 0, EAttr::None, nullptr, argListType, 0); - if (argListType != ArgumentListType::Normal) - scope.raiseError(errInvalidOperation, current); + case TargetMode::External: + case TargetMode::WinApi: + { + compileMessageArguments(current, arguments, 0, EAttr::None, nullptr, argListType, 0); + if (argListType != ArgumentListType::Normal) + scope.raiseError(errInvalidOperation, current); - retVal = compileExternalOp(node, source.reference, - source.mode == TargetMode::WinApi, arguments, expectedRef); - break; - } - case TargetMode::CreatingArray: - { - compileMessageArguments(current, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); - if (argListType != ArgumentListType::Normal) - scope.raiseError(errInvalidOperation, current); + retVal = compileExternalOp(node, source.reference, + source.mode == TargetMode::WinApi, arguments, expectedRef); + break; + } + case TargetMode::CreatingArray: + { + compileMessageArguments(current, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); + if (argListType != ArgumentListType::Normal) + scope.raiseError(errInvalidOperation, current); - retVal = compileNewArrayOp(node, source, expectedRef, arguments); - break; - } - case TargetMode::Creating: - { - ref_t signRef = compileMessageArguments(current, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); - if (argListType != ArgumentListType::Normal) - scope.raiseError(errInvalidOperation, current); + retVal = compileNewArrayOp(node, source, expectedRef, arguments); + break; + } + case TargetMode::Creating: + { + ref_t signRef = compileMessageArguments(current, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); + if (argListType != ArgumentListType::Normal) + scope.raiseError(errInvalidOperation, current); - retVal = compileNewOp(node, Compiler::mapClassSymbol(scope, - compiler->resolveStrongType(scope, source.typeInfo)), signRef, arguments); - break; - } - case TargetMode::Casting: - { - retVal = compileMessageOperationR(source, current, false); - break; - } - default: - { - // NOTE : the operation target shouldn't be a primtive type - source = validateObject(node, source, 0, true, true, false, false); + retVal = compileNewOp(node, Compiler::mapClassSymbol(scope, + compiler->resolveStrongType(scope, source.typeInfo)), signRef, arguments); + break; + } + case TargetMode::Casting: + { + retVal = compileMessageOperationR(source, current, false); + break; + } + default: + { + // NOTE : the operation target shouldn't be a primtive type + source = validateObject(node, source, 0, true, true, false, false); - current = current.nextNode(); + current = current.nextNode(); - retVal = compileMessageOperationR(node, current, source, arguments, - &updatedOuterArgs, expectedRef, false, probeMode, false, attrs); + retVal = compileMessageOperationR(node, current, source, arguments, + &updatedOuterArgs, expectedRef, false, probeMode, false, attrs); - break; - } + break; + } } return retVal; @@ -11832,23 +12020,54 @@ ObjectInfo Compiler::Expression::compileSpecialOperation(SyntaxNode node, int op { ObjectInfo retVal = {}; switch (operatorId) { - case BREAK_OPERATOR_ID: - writer->appendNode(BuildKey::BreakOp); - break; - case CONTINUE_OPERATOR_ID: - writer->appendNode(BuildKey::ContinueOp); - break; - default: - assert(false); - break; + case BREAK_OPERATOR_ID: + writer->appendNode(BuildKey::BreakOp); + break; + case CONTINUE_OPERATOR_ID: + writer->appendNode(BuildKey::ContinueOp); + break; + default: + assert(false); + break; } return retVal; } -void Compiler::Expression :: compileAsyncOperation(SyntaxNode node) +void Compiler::Expression :: compileAsyncOperation(SyntaxNode node, bool valueExpected) { - assert(false); + StatemachineClassScope* smScope = Scope::getScope(scope, Scope::ScopeLevel::Statemachine); + if (!smScope) + scope.raiseError(errInvalidOperation, node); + + ObjectInfo contextField = smScope->mapContextField(); + ObjectInfo currentField = smScope->mapCurrentField(); + + writer->newNode(BuildKey::YieldingOp, -scope.moduleScope->ptrSize); + writer->newNode(BuildKey::Tape); + + ObjectInfo retVal = compile(node.firstChild(), smScope->typeRef, EAttr::None, nullptr); + + bool nillableOp = false; + if (!compileAssigningOp(currentField, retVal, nillableOp)) + scope.raiseError(errInvalidOperation, node); + + if (nillableOp) + scope.raiseWarning(WARNING_LEVEL_1, wrnReturningNillable, node); + + writeObjectInfo(contextField, node); + writer->appendNode(BuildKey::SavingStackDump); + + // returning true + writeObjectInfo({ ObjectKind::Singleton, { scope.moduleScope->branchingInfo.typeRef }, scope.moduleScope->branchingInfo.trueRef }); + + writer->appendNode(BuildKey::goingToEOP); + + writer->closeNode(); + writer->closeNode(); + + if (valueExpected) + writeObjectInfo(currentField, node); } void Compiler::Expression :: compileYieldOperation(SyntaxNode node) @@ -11989,20 +12208,28 @@ ObjectInfo Compiler::Expression::compileAssignOperation(SyntaxNode node, int ope } else { switch (operatorId) { - case ADD_ASSIGN_OPERATOR_ID: - operatorId = ADD_OPERATOR_ID; - break; - case SUB_ASSIGN_OPERATOR_ID: - operatorId = SUB_OPERATOR_ID; - break; - case MUL_ASSIGN_OPERATOR_ID: - operatorId = MUL_OPERATOR_ID; - break; - case DIV_ASSIGN_OPERATOR_ID: - operatorId = DIV_OPERATOR_ID; - break; - default: - break; + case ADD_ASSIGN_OPERATOR_ID: + operatorId = ADD_OPERATOR_ID; + break; + case SUB_ASSIGN_OPERATOR_ID: + operatorId = SUB_OPERATOR_ID; + break; + case MUL_ASSIGN_OPERATOR_ID: + operatorId = MUL_OPERATOR_ID; + break; + case DIV_ASSIGN_OPERATOR_ID: + operatorId = DIV_OPERATOR_ID; + break; + case INC_OPERATOR_ID: + operatorId = ADD_OPERATOR_ID; + roperand = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(scope.moduleScope, 1), 1 }; + break; + case DEC_OPERATOR_ID: + operatorId = SUB_OPERATOR_ID; + roperand = { ObjectKind::IntLiteral, { V_INT32 }, ::mapIntConstant(scope.moduleScope, 1), 1 }; + break; + default: + break; } mssg_t message = Compiler::resolveOperatorMessage(scope.moduleScope, operatorId); @@ -13069,7 +13296,7 @@ ObjectInfo Compiler::Expression::compileExternalOp(SyntaxNode node, ref_t extern return { ObjectKind::Extern, retType, 0 }; } -void Compiler::Expression::compileNestedInitializing(InlineClassScope& classScope, ref_t nestedRef, int& preservedClosure, +void Compiler::Expression :: compileNestedInitializing(InlineClassScope& classScope, ref_t nestedRef, int& preservedContext, ArgumentsInfo* updatedOuterArgs) { ArgumentsInfo list; @@ -13105,7 +13332,7 @@ void Compiler::Expression::compileNestedInitializing(InlineClassScope& classScop // second pass : fill members int argIndex = 0; - preservedClosure = 0; + preservedContext = 0; for (auto it = classScope.outers.start(); !it.eof(); ++it) { ObjectInfo source = (*it).outerObject; ObjectInfo arg = list[argIndex]; @@ -13127,10 +13354,10 @@ void Compiler::Expression::compileNestedInitializing(InlineClassScope& classScop } if (updatedOuterArgs && (*it).updated) { - if (!preservedClosure) { - updatedOuterArgs->add({ ObjectKind::ClosureInfo }); - // reserve place for the closure - preservedClosure = updatedOuterArgs->count_pos(); + if (!preservedContext) { + updatedOuterArgs->add({ ObjectKind::ContextInfo }); + // reserve place for the context info + preservedContext = updatedOuterArgs->count_pos(); updatedOuterArgs->add({ }); } @@ -13321,7 +13548,7 @@ ObjectInfo Compiler::Expression::convertObject(SyntaxNode node, ObjectInfo sourc return source; } -Compiler::MessageResolution Compiler::Expression::resolveByRefHandler(ObjectInfo source, ref_t expectedRef, +Compiler::MessageResolution Compiler::Expression :: resolveByRefHandler(ObjectInfo source, ref_t expectedRef, mssg_t weakMessage, ref_t& signatureRef, bool noExtensions) { if (source.mode == TargetMode::Weak) @@ -13340,7 +13567,7 @@ Compiler::MessageResolution Compiler::Expression::resolveByRefHandler(ObjectInfo if (expectedRef != 0 && targetRef != 0) { // try to resolve the weak message MessageResolution resolution = resolveMessageAtCompileTime(source, weakMessage, - signatureRef, noExtensions, true); + signatureRef, noExtensions, true, true); if (resolution.resolved || argCount == 1) { ref_t resolvedFlags = resolution.resolved ? getFlags(resolution.message) : flags; @@ -13354,13 +13581,24 @@ Compiler::MessageResolution Compiler::Expression::resolveByRefHandler(ObjectInfo ref_t byRefMessage = encodeMessage(scope.module->mapAction(actionName, byRefSignature, false), argCount + 1, resolvedFlags); - ref_t byRefTarget = resolution.extensionRef ? resolution.extensionRef : targetRef; - CheckMethodResult dummy = {}; - if (compiler->_logic->resolveCallType(*scope.moduleScope, byRefTarget, byRefMessage, dummy)) { - // NOTE : the original signature is extended with byref handler - signatureRef = compiler->_logic->defineByRefSignature(*scope.moduleScope, signatureRef, byRefType);; + if (resolution.byRefHandler && compiler->_logic->isSignatureCompatible(*scope.moduleScope, byRefMessage, resolution.byRefHandler)) { + byRefMessage = resolution.byRefHandler; + scope.module->resolveAction(getAction(byRefMessage), signatureRef); resolution.resolved = true; + } + else { + ref_t byRefTarget = resolution.extensionRef ? resolution.extensionRef : targetRef; + CheckMethodResult dummy = {}; + if (compiler->_logic->resolveCallType(*scope.moduleScope, byRefTarget, byRefMessage, dummy)) { + // NOTE : the original signature is extended with byref handler + signatureRef = compiler->_logic->defineByRefSignature(*scope.moduleScope, signatureRef, byRefType);; + + resolution.resolved = true; + } + else resolution.resolved = false; + } + if (resolution.resolved) { resolution.message = byRefMessage; // NOTE : the stack safe attributes are resolved again the target signature @@ -13416,13 +13654,14 @@ ObjectInfo Compiler::Expression::declareTempLocal(ref_t typeRef, bool dynamicOnl } } -ObjectInfo Compiler::Expression::compileMessageOperation(SyntaxNode node, ObjectInfo target, MessageResolution resolution, ref_t implicitSignatureRef, +ObjectInfo Compiler::Expression :: compileMessageOperation(SyntaxNode node, ObjectInfo target, MessageResolution resolution, ref_t implicitSignatureRef, ArgumentsInfo& arguments, ExpressionAttributes mode, ArgumentsInfo* updatedOuterArgs) { bool vargCastingRequired = EAttrs::testAndExclude(mode.attrs, EAttr::WithVariadicArgCast); bool argUnboxingRequired = vargCastingRequired || EAttrs::testAndExclude(mode.attrs, EAttr::WithVariadicArg); bool checkShortCircle = EAttrs::testAndExclude(mode.attrs, EAttr::CheckShortCircle); bool allowPrivateCall = EAttrs::testAndExclude(mode.attrs, EAttr::AllowPrivateCall); + bool indexedCallMode = false; ObjectInfo retVal(ObjectKind::Object); @@ -13450,63 +13689,49 @@ ObjectInfo Compiler::Expression::compileMessageOperation(SyntaxNode node, Object bool found = target.mode != TargetMode::Weak ? compiler->_logic->resolveCallType(*scope.moduleScope, targetRef, resolution.message, result) : false; if (found) { - switch (result.visibility) { - case Visibility::Private: - if (allowPrivateCall || isSelfCall(target) || isClassClassOperation(scope, target)) { - resolution.message = result.message; - } - else found = false; - break; - case Visibility::Protected: - if (isSelfCall(target) || target.kind == ObjectKind::SuperLocal) { - resolution.message = result.message; - } - else found = false; - break; - case Visibility::Internal: - if (scope.moduleScope->isInternalOp(targetRef)) { - resolution.message = result.message; - } - else found = false; - break; - default: - break; + if (checkValidity(target, result, allowPrivateCall)) { + resolution.message = result.message; } + else found = false; } if (found) { retVal.typeInfo = result.outputInfo; switch ((MethodHint)result.kind) { - case MethodHint::Sealed: - if (result.constRef && compiler->_optMode) { - NamespaceScope* nsScope = Scope::getScope(scope, Scope::ScopeLevel::Namespace); + case MethodHint::Sealed: + if (result.constRef && compiler->_optMode) { + NamespaceScope* nsScope = Scope::getScope(scope, Scope::ScopeLevel::Namespace); - retVal = nsScope->defineObjectInfo(result.constRef, EAttr::None, true); + retVal = nsScope->defineObjectInfo(result.constRef, EAttr::None, true); - operation = BuildKey::None; - } - else operation = BuildKey::DirectCallOp; - // HOTFIX : do not box the variadic argument target for the direct operation - if (arguments[0].kind == ObjectKind::VArgParam) - result.stackSafe = true; - - if (checkShortCircle && validateShortCircle(resolution.message, target)) { - if (compiler->_verbose) { - showContextInfo(resolution.message, targetRef); + operation = BuildKey::None; } + else operation = BuildKey::DirectCallOp; + // HOTFIX : do not box the variadic argument target for the direct operation + if (arguments[0].kind == ObjectKind::VArgParam) + result.stackSafe = true; + + if (checkShortCircle && validateShortCircle(resolution.message, target)) { + if (compiler->_verbose) { + showContextInfo(resolution.message, targetRef); + } - if (target.kind == ObjectKind::ConstructorSelf) { - scope.raiseError(errRedirectToItself, node); + if (target.kind == ObjectKind::ConstructorSelf) { + scope.raiseError(errRedirectToItself, node); + } + else scope.raiseWarning(WARNING_LEVEL_1, wrnCallingItself, findMessageNode(node)); } - else scope.raiseWarning(WARNING_LEVEL_1, wrnCallingItself, findMessageNode(node)); - } - break; - case MethodHint::Virtual: - operation = BuildKey::SemiDirectCallOp; - break; - default: - break; + break; + case MethodHint::Fixed: + operation = BuildKey::SemiDirectCallOp; + break; + case MethodHint::ByIndex: + operation = BuildKey::SemiDirectCallOp; + indexedCallMode = true; + break; + default: + break; } if (operation != BuildKey::CallOp) { // if the method directly resolved and the target is not required to be dynamic, mark it as stacksafe @@ -13533,7 +13758,7 @@ ObjectInfo Compiler::Expression::compileMessageOperation(SyntaxNode node, Object showContextInfo(resolution.message, targetRef); } - if (test(resolution.message, CONVERSION_MESSAGE)) { + if ((resolution.message & PREFIX_MESSAGE_MASK) == CONVERSION_MESSAGE) { scope.raiseWarning(WARNING_LEVEL_1, wrnUnknownTypecast, node); } else if (resolution.message == scope.moduleScope->buildins.refer_message) { @@ -13588,6 +13813,8 @@ ObjectInfo Compiler::Expression::compileMessageOperation(SyntaxNode node, Object if (targetRef) writer->appendNode(BuildKey::Type, targetRef); + if (indexedCallMode) + writer->appendNode(BuildKey::IndexTableMode); writer->closeNode(); @@ -13713,162 +13940,162 @@ ObjectInfo Compiler::Expression::compileAssigning(SyntaxNode loperand, SyntaxNod case ObjectKind::ReadOnlyFieldAddress: scope.raiseError(errAssigningRealOnly, loperand.parentNode()); break; - default: - scope.raiseError(errInvalidOperation, loperand.parentNode()); + default: + scope.raiseError(errInvalidOperation, loperand.parentNode()); + break; + } + } + + if (nillableOp) + scope.raiseWarning(WARNING_LEVEL_1, wrnAssigningNillable, roperand); + + if (target == exprVal) + scope.raiseError(errAssigningToSelf, loperand.lastChild(SyntaxKey::TerminalMask)); + + return target; +} + +bool Compiler::Expression::writeObjectInfo(ObjectInfo info, bool allowMeta) +{ + switch (info.kind) { + case ObjectKind::IntLiteral: + writer->newNode(BuildKey::IntLiteral, info.reference); + writer->appendNode(BuildKey::Value, info.extra); + writer->closeNode(); + break; + case ObjectKind::Float64Literal: + writer->appendNode(BuildKey::RealLiteral, info.reference); + break; + case ObjectKind::LongLiteral: + writer->appendNode(BuildKey::LongLiteral, info.reference); + break; + case ObjectKind::StringLiteral: + writer->appendNode(BuildKey::StringLiteral, info.reference); + break; + case ObjectKind::WideStringLiteral: + writer->appendNode(BuildKey::WideStringLiteral, info.reference); + break; + case ObjectKind::CharacterLiteral: + writer->appendNode(BuildKey::CharLiteral, info.reference); + break; + case ObjectKind::MssgLiteral: + writer->appendNode(BuildKey::MssgLiteral, info.reference); + break; + case ObjectKind::MssgNameLiteral: + writer->appendNode(BuildKey::MssgNameLiteral, info.reference); + break; + case ObjectKind::ExtMssgLiteral: + writer->appendNode(BuildKey::ExtMssgLiteral, info.reference); + break; + //case ObjectKind::MetaDictionary: + // writer.appendNode(BuildKey::MetaDictionary, info.reference); + // break; + //case ObjectKind::MetaArray: + // writer.appendNode(BuildKey::MetaArray, info.reference); + // break; + case ObjectKind::Nil: + writer->appendNode(BuildKey::NilReference, 0); + break; + case ObjectKind::Terminator: + writer->appendNode(BuildKey::TerminatorReference, 0); + break; + case ObjectKind::Symbol: + writer->appendNode(BuildKey::SymbolCall, info.reference); + break; + case ObjectKind::Extension: + case ObjectKind::Class: + case ObjectKind::ClassSelf: + case ObjectKind::Singleton: + case ObjectKind::ConstantRole: + writer->appendNode(BuildKey::ClassReference, info.reference); + break; + case ObjectKind::Constant: + writer->appendNode(BuildKey::ConstantReference, info.reference); + break; + case ObjectKind::ConstArray: + writer->appendNode(BuildKey::ConstArrayReference, info.reference); + break; + case ObjectKind::Param: + case ObjectKind::SelfLocal: + case ObjectKind::SuperLocal: + case ObjectKind::ReadOnlySelfLocal: + case ObjectKind::Local: + case ObjectKind::TempLocal: + case ObjectKind::ParamAddress: + case ObjectKind::ParamReference: + case ObjectKind::SelfBoxableLocal: + case ObjectKind::ByRefParamAddress: + case ObjectKind::OutParamAddress: + case ObjectKind::ConstructorSelf: + writer->appendNode(BuildKey::Local, info.reference); + break; + case ObjectKind::LocalField: + writer->appendNode(BuildKey::Local, info.reference); + writer->appendNode(BuildKey::Field, info.extra); + break; + case ObjectKind::VArgParam: + writer->appendNode(BuildKey::LocalReference, info.reference); + break; + case ObjectKind::LocalReference: + writer->appendNode(BuildKey::LocalReference, info.reference); + break; + case ObjectKind::LocalAddress: + case ObjectKind::TempLocalAddress: + writer->appendNode(BuildKey::LocalAddress, info.reference); + break; + case ObjectKind::ReadOnlyField: + case ObjectKind::Field: + case ObjectKind::Outer: + case ObjectKind::OuterSelf: + writeObjectInfo(scope.mapSelf()); + writer->appendNode(BuildKey::Field, info.reference); + break; + case ObjectKind::OuterField: + writeObjectInfo(scope.mapSelf()); + writer->appendNode(BuildKey::Field, info.reference); + writer->appendNode(BuildKey::Field, info.extra); + break; + case ObjectKind::StaticConstField: + if (scope.isSealed(false) && !scope.isExtension(false)) { + writer->appendNode(BuildKey::ClassReference, scope.getClassRef(false)); + } + else { + writeObjectInfo(scope.mapSelf()); + writer->appendNode(BuildKey::ClassOp, CLASS_OPERATOR_ID); + } + writer->appendNode(BuildKey::Field, info.reference); + break; + case ObjectKind::ClassStaticConstField: + writeObjectInfo(scope.mapSelf()); + writer->appendNode(BuildKey::Field, info.reference); + break; + case ObjectKind::StaticField: + writer->appendNode(BuildKey::StaticVar, info.reference); + break; + case ObjectKind::StaticThreadField: + writer->appendNode(BuildKey::ThreadVar, info.reference); + break; + case ObjectKind::ByRefParam: + case ObjectKind::OutParam: + writeObjectInfo({ ObjectKind::Param, info.typeInfo, info.reference }); + writer->appendNode(BuildKey::Field); break; - } - } - - if (nillableOp) - scope.raiseWarning(WARNING_LEVEL_1, wrnAssigningNillable, roperand); - - if (target == exprVal) - scope.raiseError(errAssigningToSelf, loperand.lastChild(SyntaxKey::TerminalMask)); - - return target; -} - -bool Compiler::Expression::writeObjectInfo(ObjectInfo info, bool allowMeta) -{ - switch (info.kind) { - case ObjectKind::IntLiteral: - writer->newNode(BuildKey::IntLiteral, info.reference); - writer->appendNode(BuildKey::Value, info.extra); - writer->closeNode(); - break; - case ObjectKind::Float64Literal: - writer->appendNode(BuildKey::RealLiteral, info.reference); - break; - case ObjectKind::LongLiteral: - writer->appendNode(BuildKey::LongLiteral, info.reference); - break; - case ObjectKind::StringLiteral: - writer->appendNode(BuildKey::StringLiteral, info.reference); - break; - case ObjectKind::WideStringLiteral: - writer->appendNode(BuildKey::WideStringLiteral, info.reference); - break; - case ObjectKind::CharacterLiteral: - writer->appendNode(BuildKey::CharLiteral, info.reference); - break; - case ObjectKind::MssgLiteral: - writer->appendNode(BuildKey::MssgLiteral, info.reference); - break; - case ObjectKind::MssgNameLiteral: - writer->appendNode(BuildKey::MssgNameLiteral, info.reference); - break; - case ObjectKind::ExtMssgLiteral: - writer->appendNode(BuildKey::ExtMssgLiteral, info.reference); - break; - //case ObjectKind::MetaDictionary: - // writer.appendNode(BuildKey::MetaDictionary, info.reference); - // break; - //case ObjectKind::MetaArray: - // writer.appendNode(BuildKey::MetaArray, info.reference); - // break; - case ObjectKind::Nil: - writer->appendNode(BuildKey::NilReference, 0); - break; - case ObjectKind::Terminator: - writer->appendNode(BuildKey::TerminatorReference, 0); - break; - case ObjectKind::Symbol: - writer->appendNode(BuildKey::SymbolCall, info.reference); - break; - case ObjectKind::Extension: - case ObjectKind::Class: - case ObjectKind::ClassSelf: - case ObjectKind::Singleton: - case ObjectKind::ConstantRole: - writer->appendNode(BuildKey::ClassReference, info.reference); - break; - case ObjectKind::Constant: - writer->appendNode(BuildKey::ConstantReference, info.reference); - break; - case ObjectKind::ConstArray: - writer->appendNode(BuildKey::ConstArrayReference, info.reference); - break; - case ObjectKind::Param: - case ObjectKind::SelfLocal: - case ObjectKind::SuperLocal: - case ObjectKind::ReadOnlySelfLocal: - case ObjectKind::Local: - case ObjectKind::TempLocal: - case ObjectKind::ParamAddress: - case ObjectKind::ParamReference: - case ObjectKind::SelfBoxableLocal: - case ObjectKind::ByRefParamAddress: - case ObjectKind::OutParamAddress: - case ObjectKind::ConstructorSelf: - writer->appendNode(BuildKey::Local, info.reference); - break; - case ObjectKind::LocalField: - writer->appendNode(BuildKey::Local, info.reference); - writer->appendNode(BuildKey::Field, info.extra); - break; - case ObjectKind::VArgParam: - writer->appendNode(BuildKey::LocalReference, info.reference); - break; - case ObjectKind::LocalReference: - writer->appendNode(BuildKey::LocalReference, info.reference); - break; - case ObjectKind::LocalAddress: - case ObjectKind::TempLocalAddress: - writer->appendNode(BuildKey::LocalAddress, info.reference); - break; - case ObjectKind::ReadOnlyField: - case ObjectKind::Field: - case ObjectKind::Outer: - case ObjectKind::OuterSelf: - writeObjectInfo(scope.mapSelf()); - writer->appendNode(BuildKey::Field, info.reference); - break; - case ObjectKind::OuterField: - writeObjectInfo(scope.mapSelf()); - writer->appendNode(BuildKey::Field, info.reference); - writer->appendNode(BuildKey::Field, info.extra); - break; - case ObjectKind::StaticConstField: - if (scope.isSealed(false)) { - writer->appendNode(BuildKey::ClassReference, scope.getClassRef(false)); - } - else { - writeObjectInfo(scope.mapSelf()); - writer->appendNode(BuildKey::ClassOp, CLASS_OPERATOR_ID); - } - writer->appendNode(BuildKey::Field, info.reference); - break; - case ObjectKind::ClassStaticConstField: - writeObjectInfo(scope.mapSelf()); - writer->appendNode(BuildKey::Field, info.reference); - break; - case ObjectKind::StaticField: - writer->appendNode(BuildKey::StaticVar, info.reference); - break; - case ObjectKind::StaticThreadField: - writer->appendNode(BuildKey::ThreadVar, info.reference); - break; - case ObjectKind::ByRefParam: - case ObjectKind::OutParam: - writeObjectInfo({ ObjectKind::Param, info.typeInfo, info.reference }); - writer->appendNode(BuildKey::Field); - break; - case ObjectKind::ClassConstant: - if (info.reference == INVALID_REF) - throw InternalError(errFatalError); + case ObjectKind::ClassConstant: + if (info.reference == INVALID_REF) + throw InternalError(errFatalError); - writer->appendNode(BuildKey::ConstantReference, info.reference); - break; - case ObjectKind::DistributedTypeList: - if (allowMeta) { - writer->appendNode(BuildKey::DistributedTypeList, info.reference); - } - else return false; - break; - case ObjectKind::Object: - break; - default: - return false; + writer->appendNode(BuildKey::ConstantReference, info.reference); + break; + case ObjectKind::DistributedTypeList: + if (allowMeta) { + writer->appendNode(BuildKey::DistributedTypeList, info.reference); + } + else return false; + break; + case ObjectKind::Object: + break; + default: + return false; } return true; @@ -13878,36 +14105,36 @@ ObjectInfo Compiler::Expression::boxArgumentLocally(ObjectInfo info, bool stackSafe, bool forced) { switch (info.kind) { - case ObjectKind::Field: - case ObjectKind::Outer: - case ObjectKind::OuterField: - case ObjectKind::StaticField: - case ObjectKind::StaticThreadField: - if (forced) { - return boxLocally(info, stackSafe); - } - return info; - case ObjectKind::ReadOnlyFieldAddress: - case ObjectKind::FieldAddress: - if (info.argument == 0 && !forced) { - ObjectInfo retVal = scope.mapSelf(); - // HOTFIX : no conditional boxing in this case - if (retVal.mode == TargetMode::Conditional) - retVal.mode = TargetMode::None; + case ObjectKind::Field: + case ObjectKind::Outer: + case ObjectKind::OuterField: + case ObjectKind::StaticField: + case ObjectKind::StaticThreadField: + if (forced) { + return boxLocally(info, stackSafe); + } + return info; + case ObjectKind::ReadOnlyFieldAddress: + case ObjectKind::FieldAddress: + if (info.argument == 0 && !forced) { + ObjectInfo retVal = scope.mapSelf(); + // HOTFIX : no conditional boxing in this case + if (retVal.mode == TargetMode::Conditional) + retVal.mode = TargetMode::None; - retVal.typeInfo = info.typeInfo; + retVal.typeInfo = info.typeInfo; - return retVal; - } - else return boxLocally(info, stackSafe); - case ObjectKind::StaticConstField: - case ObjectKind::ClassStaticConstField: - if (info.mode == TargetMode::BoxingPtr) { - return boxPtrLocally(info); - } - else return info; - default: - return info; + return retVal; + } + else return boxLocally(info, stackSafe); + case ObjectKind::StaticConstField: + case ObjectKind::ClassStaticConstField: + if (info.mode == TargetMode::BoxingPtr) { + return boxPtrLocally(info); + } + else return info; + default: + return info; } } @@ -14002,7 +14229,7 @@ ObjectInfo Compiler::Expression::compileWeakOperation(SyntaxNode node, ref_t* ar ref_t signRef = (!weakSignature && argLen > 1) ? scope.module->mapSignature(arguments, argLen - 1, false) : 0; auto byRefResolution = resolveByRefHandler(loperand, expectedRef, message, signRef, true); - if (byRefResolution.resolved) { + if (byRefResolution.resolved && checkValidity(loperand, byRefResolution, false)) { ObjectInfo tempRetVal = declareTempLocal(expectedRef, false); addOutRetVal(messageArguments, tempRetVal); @@ -14035,124 +14262,124 @@ bool Compiler::Expression::compileAssigningOp(ObjectInfo target, ObjectInfo expr bool lenRequired = false; switch (target.kind) { - case ObjectKind::Local: - case ObjectKind::TempLocal: - scope.markAsAssigned(target); - operationType = BuildKey::Assigning; - operand = target.reference; - break; - case ObjectKind::ByRefParam: - operationType = BuildKey::RefParamAssigning; - operand = target.reference; - break; - case ObjectKind::OutParam: - scope.markAsAssigned(target); - operationType = BuildKey::RefParamAssigning; - operand = target.reference; - break; - case ObjectKind::SelfBoxableLocal: - case ObjectKind::ParamAddress: - accMode = true; - operationType = BuildKey::CopyingToAcc; - operand = target.reference; - size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; - stackSafe = true; - break; - case ObjectKind::TempLocalAddress: - case ObjectKind::LocalAddress: - scope.markAsAssigned(target); - if (target.typeInfo.typeRef == V_WRAPPER) { - size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.elementRef).size; - } - else size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; - if (size > 0) { - operationType = BuildKey::Copying; + case ObjectKind::Local: + case ObjectKind::TempLocal: + scope.markAsAssigned(target); + operationType = BuildKey::Assigning; operand = target.reference; - } - else { - lenRequired = true; + break; + case ObjectKind::ByRefParam: + operationType = BuildKey::RefParamAssigning; + operand = target.reference; + break; + case ObjectKind::OutParam: + scope.markAsAssigned(target); + operationType = BuildKey::RefParamAssigning; + operand = target.reference; + break; + case ObjectKind::SelfBoxableLocal: + case ObjectKind::ParamAddress: accMode = true; - operationType = BuildKey::CopyingArr; - size = -size; - } - stackSafe = true; - break; - case ObjectKind::Field: - scope.markAsAssigned(target); - operationType = BuildKey::FieldAssigning; - operand = target.reference; - fieldMode = true; - break; - case ObjectKind::OuterField: - scope.markAsAssigned(target); - operationType = BuildKey::FieldAssigning; - operand = target.extra; - fieldFieldMode = fieldMode = true; - break; - case ObjectKind::StaticField: - scope.markAsAssigned(target); - operationType = BuildKey::StaticAssigning; - operand = target.reference; - break; - case ObjectKind::StaticThreadField: - scope.markAsAssigned(target); - operationType = BuildKey::ThreadVarAssigning; - operand = target.reference; - break; - case ObjectKind::FieldAddress: - scope.markAsAssigned(target); - fieldMode = true; - if (target.reference) { - operationType = BuildKey::CopyingToAccField; + operationType = BuildKey::CopyingToAcc; operand = target.reference; - } - else operationType = BuildKey::CopyingToAccExact; - operand = target.reference; - size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; - if (size < 0) { - size = target.extra; - } - stackSafe = true; - - assert(size > 0); - - break; - case ObjectKind::OutParamAddress: - scope.markAsAssigned(target); - case ObjectKind::ByRefParamAddress: - { - ref_t targetRef = compiler->resolveStrongType(scope, target.typeInfo); - size = compiler->_logic->defineStructSize(*scope.moduleScope, targetRef).size; - if (size > 0) { + size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; stackSafe = true; - operationType = BuildKey::CopyingToAcc; + break; + case ObjectKind::TempLocalAddress: + case ObjectKind::LocalAddress: + scope.markAsAssigned(target); + if (target.typeInfo.typeRef == V_WRAPPER) { + size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.elementRef).size; + } + else size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; + if (size > 0) { + operationType = BuildKey::Copying; + operand = target.reference; + } + else { + lenRequired = true; + accMode = true; + operationType = BuildKey::CopyingArr; + size = -size; + } + stackSafe = true; + break; + case ObjectKind::Field: + scope.markAsAssigned(target); + operationType = BuildKey::FieldAssigning; operand = target.reference; - accMode = true; - } - else assert(false); // !! temporally + fieldMode = true; + break; + case ObjectKind::OuterField: + scope.markAsAssigned(target); + operationType = BuildKey::FieldAssigning; + operand = target.extra; + fieldFieldMode = fieldMode = true; + break; + case ObjectKind::StaticField: + scope.markAsAssigned(target); + operationType = BuildKey::StaticAssigning; + operand = target.reference; + break; + case ObjectKind::StaticThreadField: + scope.markAsAssigned(target); + operationType = BuildKey::ThreadVarAssigning; + operand = target.reference; + break; + case ObjectKind::FieldAddress: + scope.markAsAssigned(target); + fieldMode = true; + if (target.reference) { + operationType = BuildKey::CopyingToAccField; + operand = target.reference; + } + else operationType = BuildKey::CopyingToAccExact; + operand = target.reference; + size = compiler->_logic->defineStructSize(*scope.moduleScope, target.typeInfo.typeRef).size; + if (size < 0) { + size = target.extra; + } + stackSafe = true; - break; - } - case ObjectKind::Outer: - { - InlineClassScope* closure = Scope::getScope(scope, Scope::ScopeLevel::Class); - if (/*!method->subCodeMode || */!closure->markAsPresaved(target)) - return false; + assert(size > 0); - operationType = BuildKey::FieldAssigning; - operand = target.reference; - fieldMode = true; + break; + case ObjectKind::OutParamAddress: + scope.markAsAssigned(target); + case ObjectKind::ByRefParamAddress: + { + ref_t targetRef = compiler->resolveStrongType(scope, target.typeInfo); + size = compiler->_logic->defineStructSize(*scope.moduleScope, targetRef).size; + if (size > 0) { + stackSafe = true; + operationType = BuildKey::CopyingToAcc; + operand = target.reference; + accMode = true; + } + else assert(false); // !! temporally - break; - } - case ObjectKind::LocalField: - localFieldMode = true; - operationType = BuildKey::FieldAssigning; - operand = target.extra; + break; + } + case ObjectKind::Outer: + { + InlineClassScope* closure = Scope::getScope(scope, Scope::ScopeLevel::Class); + if (/*!method->subCodeMode || */!closure->markAsPresaved(target)) + return false; - break; - default: - return false; + operationType = BuildKey::FieldAssigning; + operand = target.reference; + fieldMode = true; + + break; + } + case ObjectKind::LocalField: + localFieldMode = true; + operationType = BuildKey::FieldAssigning; + operand = target.extra; + + break; + default: + return false; } if (!writeObjectInfo(boxArgument(exprVal, stackSafe, true, false))) @@ -14381,34 +14608,34 @@ ObjectInfo Compiler::Expression::compileMessageOperationR(ObjectInfo target, Syn ArgumentsInfo arguments; switch (target.mode) { - case TargetMode::Casting: - { - ArgumentListType argListType = ArgumentListType::Normal; - compileMessageArguments(messageNode, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); - if (arguments.count() == 1) { - ref_t targetRef = compiler->resolveStrongType(scope, target.typeInfo); + case TargetMode::Casting: + { + ArgumentListType argListType = ArgumentListType::Normal; + compileMessageArguments(messageNode, arguments, 0, EAttr::NoPrimitives, nullptr, argListType, 0); + if (arguments.count() == 1) { + ref_t targetRef = compiler->resolveStrongType(scope, target.typeInfo); - if (argListType == ArgumentListType::VariadicArgList) { - arguments[0].mode = TargetMode::UnboxingAndTypecastingVarArgument; - arguments[0].typeInfo = { V_ARGARRAY, targetRef }; + if (argListType == ArgumentListType::VariadicArgList) { + arguments[0].mode = TargetMode::UnboxingAndTypecastingVarArgument; + arguments[0].typeInfo = { V_ARGARRAY, targetRef }; - return arguments[0]; + return arguments[0]; + } + else return convertObject(messageNode, arguments[0], targetRef, false, true, false, true); } - else return convertObject(messageNode, arguments[0], targetRef, false, true, false, true); + else scope.raiseError(errInvalidOperation, messageNode); + break; } - else scope.raiseError(errInvalidOperation, messageNode); - break; - } - default: - { - ArgumentsInfo updatedOuterArgs; + default: + { + ArgumentsInfo updatedOuterArgs; - // NOTE : the operation target shouldn't be a primitive type - ObjectInfo source = validateObject(messageNode, target, 0, true, true, false, false); + // NOTE : the operation target shouldn't be a primitive type + ObjectInfo source = validateObject(messageNode, target, 0, true, true, false, false); - return compileMessageOperationR(messageNode, messageNode, source, arguments, &updatedOuterArgs, 0, - propertyMode, false, false, EAttr::None); - } + return compileMessageOperationR(messageNode, messageNode, source, arguments, &updatedOuterArgs, 0, + propertyMode, false, false, EAttr::None); + } } return {}; @@ -14606,26 +14833,26 @@ ObjectInfo Compiler::Expression::compileOperation(SyntaxNode node, ArgumentsInfo } switch (op) { - case BuildKey::BinaryArraySOp: - case BuildKey::BinaryArrayOp: - writer->appendNode(BuildKey::Size, compiler->_logic->defineStructSize(*scope.moduleScope, loperand.typeInfo.elementRef).size); - break; - case BuildKey::BoolSOp: - case BuildKey::IntCondOp: - case BuildKey::UIntCondOp: - case BuildKey::ByteCondOp: - case BuildKey::UByteCondOp: - case BuildKey::ShortCondOp: - case BuildKey::UShortCondOp: - case BuildKey::LongCondOp: - case BuildKey::LongIntCondOp: - case BuildKey::RealCondOp: - case BuildKey::NilCondOp: - writer->appendNode(BuildKey::TrueConst, scope.moduleScope->branchingInfo.trueRef); - writer->appendNode(BuildKey::FalseConst, scope.moduleScope->branchingInfo.falseRef); - break; - default: - break; + case BuildKey::BinaryArraySOp: + case BuildKey::BinaryArrayOp: + writer->appendNode(BuildKey::Size, compiler->_logic->defineStructSize(*scope.moduleScope, loperand.typeInfo.elementRef).size); + break; + case BuildKey::BoolSOp: + case BuildKey::IntCondOp: + case BuildKey::UIntCondOp: + case BuildKey::ByteCondOp: + case BuildKey::UByteCondOp: + case BuildKey::ShortCondOp: + case BuildKey::UShortCondOp: + case BuildKey::LongCondOp: + case BuildKey::LongIntCondOp: + case BuildKey::RealCondOp: + case BuildKey::NilCondOp: + writer->appendNode(BuildKey::TrueConst, scope.moduleScope->branchingInfo.trueRef); + writer->appendNode(BuildKey::FalseConst, scope.moduleScope->branchingInfo.falseRef); + break; + default: + break; } writer->closeNode(); @@ -14728,8 +14955,8 @@ ObjectInfo Compiler::Expression::allocateResult(ref_t resultRef) return {}; // NOTE : should never be reached } -Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(ObjectInfo target, mssg_t weakMessage, ref_t implicitSignatureRef, - bool ignoreExtensions, bool ignoreVariadics) +Compiler::MessageResolution Compiler::Expression :: resolveMessageAtCompileTime(ObjectInfo target, mssg_t weakMessage, ref_t implicitSignatureRef, + bool ignoreExtensions, bool ignoreVariadics, bool checkByRefHandler) { MessageResolution resolution = {}; @@ -14745,6 +14972,8 @@ Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(Ob if (resolution.message != 0) { resolution.resolved = true; resolution.stackSafeAttr = resolvedStackSafeAttr; + if (checkByRefHandler) + resolution.byRefHandler = compiler->_logic->retrieveByRefHandler(*scope.moduleScope, targetRef, resolution.message); // if the object handles the compile-time resolved message - use it return resolution; @@ -14760,6 +14989,8 @@ Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(Ob if (resolution.message != 0) { resolution.resolved = true; resolution.stackSafeAttr = resolvedStackSafeAttr; + if (checkByRefHandler) + resolution.byRefHandler = compiler->_logic->retrieveByRefHandler(*scope.moduleScope, targetRef, resolution.message); // if the object handles the compile-time resolved variadic message - use it return resolution; @@ -14772,6 +15003,9 @@ Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(Ob CheckMethodResult dummy = {}; if (compiler->_logic->resolveCallType(*scope.moduleScope, targetRef, weakMessage, dummy)) { resolution.message = weakMessage; + if (checkByRefHandler) { + resolution.byRefHandler = dummy.byRefHandler; + } return resolution; } @@ -14785,6 +15019,8 @@ Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(Ob resolution.resolved = true; resolution.extensionRef = extensionRef; resolution.stackSafeAttr = resolvedStackSafeAttr; + if (checkByRefHandler) + resolution.byRefHandler = compiler->_logic->retrieveByRefHandler(*scope.moduleScope, extensionRef, resolution.message); return resolution; } @@ -14805,6 +15041,17 @@ Compiler::MessageResolution Compiler::Expression::resolveMessageAtCompileTime(Ob resolution.stackSafeAttr = resolvedStackSafeAttr; resolution.message = variadicMessage; resolution.extensionRef = extensionRef; + if (checkByRefHandler) + resolution.byRefHandler = compiler->_logic->retrieveByRefHandler(*scope.moduleScope, extensionRef, resolution.message); + + return resolution; + } + } + else if (checkByRefHandler) { + CheckMethodResult dummy = {}; + if (compiler->_logic->resolveCallType(*scope.moduleScope, targetRef, weakMessage, dummy)) { + resolution.message = weakMessage; + resolution.byRefHandler = dummy.byRefHandler; return resolution; } @@ -15126,7 +15373,7 @@ void Compiler::Expression::unboxOuterArgs(ArgumentsInfo* updatedOuterArgs) bool dummy = false; ObjectInfo info = (*updatedOuterArgs)[i]; - if (info.kind == ObjectKind::ClosureInfo) { + if (info.kind == ObjectKind::ContextInfo) { closure = (*updatedOuterArgs)[++i]; closure.kind = ObjectKind::LocalField; } @@ -15301,10 +15548,9 @@ ObjectInfo Compiler::Expression::boxRefArgumentInPlace(ObjectInfo info, ref_t ta return tempLocal; } -ObjectInfo Compiler::Expression::boxVariadicArgument(ObjectInfo info) +ObjectInfo Compiler::Expression :: boxVariadicArgument(ObjectInfo info) { bool dummy = false; - ref_t elementRef = info.typeInfo.elementRef; if (!elementRef) elementRef = scope.moduleScope->buildins.superReference; @@ -15337,6 +15583,9 @@ ObjectInfo Compiler::Expression::boxVariadicArgument(ObjectInfo info) writeObjectInfo(destLocal); writer->appendNode(BuildKey::CopyingArr); + if (isPrimitiveRef(info.typeInfo.typeRef)) + info.typeInfo = compiler->resolveStrongTypeInfo(scope, info.typeInfo, false); + if (info.typeInfo.typeRef && info.typeInfo.typeRef != typeRef) { // if the conversion is required ObjectInfo convInfo = convertObject({}, destLocal, @@ -15346,7 +15595,6 @@ ObjectInfo Compiler::Expression::boxVariadicArgument(ObjectInfo info) destLocal.typeInfo = convInfo.typeInfo; } - return destLocal; } @@ -15541,6 +15789,9 @@ void Compiler::LambdaClosure::compile(SyntaxNode node) methodScope.info.multiMethod = multiMethod; methodScope.info.outputRef = V_AUTO; } + // try to resolve the output type for the predefined closure type + else if (scope.expectedRef != 0) + methodScope.info.outputRef = V_AUTO; if (lazyExpression) { compileExpressionMethod(methodScope, node); @@ -15687,7 +15938,7 @@ void Compiler::LambdaClosure::compileExpressionMethod(MethodScope& scope, Syntax compiler->endMethod(*writer, scope); } -void Compiler::LambdaClosure::compileClosureMethod(MethodScope& scope, SyntaxNode node) +void Compiler::LambdaClosure :: compileClosureMethod(MethodScope& scope, SyntaxNode node) { ClassScope* classScope = Scope::getScope(scope, Scope::ScopeLevel::Class); @@ -15710,7 +15961,7 @@ void Compiler::LambdaClosure::compileClosureMethod(MethodScope& scope, SyntaxNod compiler->endMethod(*writer, scope); } -ref_t Compiler::LambdaClosure::resolveClosure(mssg_t closureMessage, ref_t outputRef) +ref_t Compiler::LambdaClosure :: resolveClosure(mssg_t closureMessage, ref_t outputRef) { ref_t signRef = 0; scope.module->resolveAction(getAction(closureMessage), signRef); @@ -15718,7 +15969,7 @@ ref_t Compiler::LambdaClosure::resolveClosure(mssg_t closureMessage, ref_t outpu int paramCount = getArgCount(closureMessage); IdentifierString closureName(scope.module->resolveReference(scope.moduleScope->buildins.closureTemplateReference)); - if (signRef == 0) { + if (signRef == 0 && (outputRef == 0 || paramCount > 0)) { if (paramCount > 0) { closureName.appendInt(paramCount); } diff --git a/elenasrc3/elc/compiler.h b/elenasrc3/elc/compiler.h index 6f9a131baa..6c6462226f 100644 --- a/elenasrc3/elc/compiler.h +++ b/elenasrc3/elc/compiler.h @@ -94,7 +94,7 @@ namespace elena_lang StaticConstField, ClassStaticConstField, Wrapper, - ClosureInfo, + ContextInfo, MemberInfo, LocalField, ConstGetter, // key = value constant @@ -363,6 +363,7 @@ namespace elena_lang Symbol, Class, OwnerClass, + ClassClass, Statemachine, Method, Field, @@ -695,6 +696,14 @@ namespace elena_lang ref_t classInfoRef; public: + Scope* getScope(ScopeLevel level) override + { + if (level == ScopeLevel::ClassClass) { + return this; + } + else return ClassScope::getScope(level); + } + ref_t getProperClassRef() { return classInfoRef; } ObjectInfo mapField(ustr_t identifier, ExpressionAttribute attr) override; @@ -777,7 +786,6 @@ namespace elena_lang } bool checkType(MethodHint type); - static bool checkType(MethodInfo& methodInfo, MethodHint type); bool isGeneric() { @@ -863,6 +871,12 @@ namespace elena_lang return scope ? scope->message : 0; } + bool isSealedMethod() + { + MethodScope* scope = Scope::getScope(*this, ScopeLevel::Method); + + return scope->checkType(MethodHint::Sealed); + } TypeInfo getOutputInfo() { @@ -973,12 +987,24 @@ namespace elena_lang return scope ? scope->reference : 0; } + ref_t getClassFlags(bool ownerClass = true) + { + ClassScope* scope = Scope::getScope(*this, ownerClass ? ScopeLevel::OwnerClass : ScopeLevel::Class); + + return scope ? scope->info.header.flags : 0; + } ref_t isSealed(bool ownerClass = true) { ClassScope* scope = Scope::getScope(*this, ownerClass ? ScopeLevel::OwnerClass : ScopeLevel::Class); return scope ? test(scope->info.header.flags, elSealed) : false; } + ref_t isExtension(bool ownerClass = true) + { + ClassScope* scope = Scope::getScope(*this, ownerClass ? ScopeLevel::OwnerClass : ScopeLevel::Class); + + return scope ? (scope->extensionClassRef != 0) : false; + } ObjectInfo mapSelf(bool ownerClass = false) { @@ -1053,6 +1079,8 @@ namespace elena_lang { pos_t contextSize; ref_t typeRef; + ref_t resultRef; + bool asyncMode; ObjectInfo mapContextField() { @@ -1065,10 +1093,10 @@ namespace elena_lang if (level == ScopeLevel::Statemachine) { return this; } - else return InlineClassScope::getScope(level); + else return Scope::getScope(level); } - StatemachineClassScope(ExprScope* owner, ref_t reference); + StatemachineClassScope(ExprScope* owner, ref_t reference, bool asyncMode); }; struct MessageResolution @@ -1077,6 +1105,7 @@ namespace elena_lang mssg_t message; ref_t extensionRef; int stackSafeAttr; + mssg_t byRefHandler; MessageResolution() { @@ -1084,6 +1113,7 @@ namespace elena_lang this->message = 0; this->extensionRef = 0; this->stackSafeAttr = 0; + this->byRefHandler = 0; } MessageResolution(bool resolved, mssg_t message) { @@ -1091,6 +1121,7 @@ namespace elena_lang this->message = message; this->extensionRef = 0; this->stackSafeAttr = 0; + this->byRefHandler = 0; } MessageResolution(mssg_t message) { @@ -1098,6 +1129,7 @@ namespace elena_lang this->message = message; this->extensionRef = 0; this->stackSafeAttr = 0; + this->byRefHandler = 0; } }; @@ -1261,6 +1293,9 @@ namespace elena_lang bool isDirectMethodCall(SyntaxNode& node); + bool checkValidity(ObjectInfo target, CheckMethodResult& result, bool allowPrivateCall); + bool checkValidity(ObjectInfo target, MessageResolution& resolution, bool allowPrivateCall); + ObjectInfo compileLookAhead(SyntaxNode node, ref_t targetRef, ExpressionAttribute attrs); @@ -1327,7 +1362,7 @@ namespace elena_lang MessageResolution resolveByRefHandler(ObjectInfo source, ref_t expectedRef, mssg_t weakMessage, ref_t& signatureRef, bool noExtensions); MessageResolution resolveMessageAtCompileTime(ObjectInfo target, mssg_t weakMessage, ref_t implicitSignatureRef, bool ignoreExtensions, - bool ignoreVariadics); + bool ignoreVariadics, bool checkByRefHandler = false); ObjectInfo declareTempLocal(ref_t typeRef, bool dynamicOnly = true); ObjectInfo declareTempStructure(SizeInfo sizeInfo); @@ -1353,11 +1388,11 @@ namespace elena_lang ObjectInfo allocateResult(ref_t resultRef); - void compileNestedInitializing(InlineClassScope& classScope, ref_t nestedRef, int& preservedClosure, + void compileNestedInitializing(InlineClassScope& classScope, ref_t nestedRef, int& preservedContext, ArgumentsInfo* updatedOuterArgs); void compileYieldOperation(SyntaxNode node); - void compileAsyncOperation(SyntaxNode node); + void compileAsyncOperation(SyntaxNode node, bool valueExpected); void compileSwitchOperation(SyntaxNode node); bool compileAssigningOp(ObjectInfo target, ObjectInfo source, bool& nillableOp); @@ -1471,6 +1506,7 @@ namespace elena_lang void saveFrameAttributes(BuildTreeWriter& writer, Scope& scope, pos_t reserved, pos_t reservedN); ref_t resolveYieldType(Scope& scope, SyntaxNode node); + ref_t declareAsyncStatemachine(StatemachineClassScope& scope, SyntaxNode node); pos_t saveMetaInfo(ModuleBase* module, ustr_t value, ustr_t postfix); @@ -1629,7 +1665,7 @@ namespace elena_lang ref_t declareClosureParameters(MethodScope& methodScope, SyntaxNode argNode); - void declareVMTMessage(MethodScope& scope, SyntaxNode node, bool withoutWeakMessages, bool declarationMode); + void declareVMTMessage(MethodScope& scope, SyntaxNode node, bool withoutWeakMessages, bool declarationMode, bool templateBasedMode); void declareClosureMessage(MethodScope& scope, SyntaxNode node); void declareIteratorMessage(MethodScope& scope, SyntaxNode node); @@ -1637,6 +1673,9 @@ namespace elena_lang void declareSymbolMetaInfo(SymbolScope& scope, SyntaxNode node); + void declareByRefHandler(SyntaxNode classNode, SyntaxKey methodType, + ref_t targetRef, ClassInfo& info, mssg_t message, bool abstractOne); + void declareMetaInfo(Scope& scope, SyntaxNode node); void declareMethodMetaInfo(MethodScope& scope, SyntaxNode node); void declareMethod(MethodScope& scope, SyntaxNode node, bool abstractMode, @@ -1750,7 +1789,7 @@ namespace elena_lang mssg_t declareInplaceConstructorHandler(MethodScope& invokerScope, ClassScope& classClassScope); mssg_t compileInplaceConstructorHandler(BuildTreeWriter& writer, MethodScope& invokerScope, ClassScope& classClassScope, SyntaxNode current, SyntaxNode methodNode, mssg_t handler); - mssg_t compileByRefHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, + void compileByRefHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, mssg_t byRefHandler); void compileByRefRedirectHandler(BuildTreeWriter& writer, MethodScope& invokerScope, SyntaxNode node, mssg_t byRefHandler); @@ -1770,7 +1809,7 @@ namespace elena_lang SyntaxNode node, bool abstractMode); void compileCustomDispatcher(BuildTreeWriter& writer, ClassScope& scope); void compileNestedClass(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode node, ref_t parentRef); - void compileStatemachineClass(BuildTreeWriter& writer, StatemachineClassScope& scope, SyntaxNode node); + void compileStatemachineClass(BuildTreeWriter& writer, StatemachineClassScope& scope, SyntaxNode node, ref_t parentRef); void compileVMT(BuildTreeWriter& writer, ClassScope& scope, SyntaxNode node, bool exclusiveMode = false, bool ignoreAutoMultimethod = false); @@ -1796,11 +1835,11 @@ namespace elena_lang void injectVirtualCode(SyntaxNode classNode, ClassScope& scope, bool interfaceBased); void injectVirtualMultimethod(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, ref_t targetRef, ClassInfo& info, mssg_t multiMethod, int nillableArgs); - void injectVirtualEmbeddableWrapper(SyntaxNode classNode, SyntaxKey methodType, - ref_t targetRef, ClassInfo& info, mssg_t multiMethod, bool abstractOne); void injectVirtualMethods(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, ref_t targetRef, ClassInfo& info, VirtualMethodList& implicitMultimethods); + void declareVirtualMethods(SyntaxNode classNode, SyntaxKey methodType, Scope& scope, + ref_t targetRef, ClassInfo& info, VirtualMethodList& implicitMultimethods); void injectInitializer(SyntaxNode classNode, SyntaxKey methodType, mssg_t message); @@ -1821,7 +1860,8 @@ namespace elena_lang void injectDefaultConstructor(ClassScope& scope, SyntaxNode node, bool protectedOne, bool withClearOption); - void injectVariableInfo(BuildNode node, CodeScope& codeScope); + void addVariableInfo(BuildNode node, Scope& codeScope, ustr_t name, Parameter& parameter); + void injectVariablesInfo(BuildNode node, CodeScope& codeScope); void injectInterfaceDispatch(Scope& scope, SyntaxNode node, ref_t parentRef); diff --git a/elenasrc3/elc/compilerlogic.cpp b/elenasrc3/elc/compilerlogic.cpp index c21a97dd07..3a3826a00c 100644 --- a/elenasrc3/elc/compilerlogic.cpp +++ b/elenasrc3/elc/compilerlogic.cpp @@ -1001,6 +1001,9 @@ bool CompilerLogic :: validateMethodAttribute(ref_t attribute, ref_t& hint, bool case V_ASYNC: hint = (ref_t)MethodHint::Async; return true; + case V_INDEXED_ATTR: + hint = (ref_t)MethodHint::Indexed; + return true; default: return false; } @@ -2193,7 +2196,7 @@ mssg_t CompilerLogic :: resolveMultimethod(ModuleScopeBase& scope, mssg_t weakMe stackSafeAttr |= 1; // check if it is non public message - mssg_t nonPublicMultiMessage = resolveNonpublic(weakMessage, info, selfCall, scope.isInternalOp(targetRef)); + mssg_t nonPublicMultiMessage = resolveNonpublic(weakMessage, info, selfCall, isInternalOp(scope, targetRef)); if (nonPublicMultiMessage != 0) { if (!implicitSignatureRef && test(nonPublicMultiMessage, STATIC_MESSAGE) && getArgCount(weakMessage) > 1) { implicitSignatureRef = mapWeakSignature(scope, getArgCount(weakMessage) - 1); @@ -2370,13 +2373,13 @@ bool CompilerLogic :: checkMethod(ClassInfo& info, mssg_t message, CheckMethodRe result.message = message; result.outputInfo = { methodInfo.outputRef }; - if (test(methodInfo.hints, (ref_t)MethodHint::Private)) { + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Private)) { result.visibility = Visibility::Private; } - else if (test(methodInfo.hints, (ref_t)MethodHint::Protected)) { + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Protected)) { result.visibility = Visibility::Protected; } - else if (test(methodInfo.hints, (ref_t)MethodHint::Internal)) { + else if (MethodInfo::checkVisibility(methodInfo, MethodHint::Internal)) { result.visibility = Visibility::Internal; } else result.visibility = Visibility::Public; @@ -2390,13 +2393,17 @@ bool CompilerLogic :: checkMethod(ClassInfo& info, mssg_t message, CheckMethodRe if (test(info.header.flags, elSealed)) { result.kind = (ref_t)MethodHint::Sealed; // mark it as sealed - because the class is sealed } + else if (MethodInfo::checkHint(methodInfo, MethodHint::Indexed)) { + result.kind = (ref_t)MethodHint::ByIndex; + } else if (test(info.header.flags, elClosed)) { - result.kind = (ref_t)MethodHint::Virtual; // mark it as virtual - because the class is closed + result.kind = (ref_t)MethodHint::Fixed; // mark it as fixed - because the class is closed } } result.stackSafe = test(methodInfo.hints, (ref_t)MethodHint::Stacksafe); result.nillableArgs = methodInfo.nillableArgs; + result.byRefHandler = methodInfo.byRefHandler; if (test(methodInfo.hints, (ref_t)MethodHint::Constant)) { result.constRef = info.attributes.get({ message, ClassAttribute::ConstantMethod }); @@ -2426,6 +2433,16 @@ bool CompilerLogic :: checkMethod(ModuleScopeBase& scope, ref_t classRef, mssg_t else return false; } +mssg_t CompilerLogic :: retrieveByRefHandler(ModuleScopeBase& scope, ref_t reference, mssg_t message) +{ + CheckMethodResult result = {}; + if (checkMethod(scope, reference, message, result)) { + return result.byRefHandler; + } + + return 0; +} + bool CompilerLogic :: isMessageSupported(ClassInfo& info, mssg_t message) { CheckMethodResult dummy = {}; @@ -2437,9 +2454,10 @@ bool CompilerLogic :: isMessageSupported(ClassInfo& info, mssg_t message, CheckM { if (!checkMethod(info, message, result)) { if (checkMethod(info, message | STATIC_MESSAGE, result)) { - result.visibility = Visibility::Private; + if (result.visibility == Visibility::Private) + return true; - return true; + result = {}; } mssg_t protectedMessage = info.attributes.get({ message, ClassAttribute::ProtectedAlias }); if (protectedMessage) { @@ -2526,7 +2544,7 @@ inline ustr_t resolveActionName(ModuleBase* module, mssg_t message) return module->resolveAction(getAction(message), signRef); } -ref_t CompilerLogic :: generateOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, ref_t flags, ClassInfo::MethodMap& methods, +ref_t CompilerLogic :: generateOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, MethodHint callType, ClassInfo::MethodMap& methods, mssg_t message, void* param, ref_t(*resolve)(void*, ref_t)) { // create a new overload list @@ -2556,13 +2574,7 @@ ref_t CompilerLogic :: generateOverloadList(CompilerBase* compiler, ModuleScopeB for (size_t i = 0; i < list.count(); i++) { ref_t classRef = resolve(param, list[i]); - if (test(flags, elSealed) || test(message, STATIC_MESSAGE)) { - compiler->generateOverloadListMember(scope, listRef, classRef, list[i], MethodHint::Sealed); - } - else if (test(flags, elClosed)) { - compiler->generateOverloadListMember(scope, listRef, classRef, list[i], MethodHint::Virtual); - } - else compiler->generateOverloadListMember(scope, listRef, classRef, list[i], MethodHint::Normal); + compiler->generateOverloadListMember(scope, listRef, classRef, list[i], callType); } return listRef; @@ -2579,11 +2591,11 @@ ref_t paramFeedback(void* param, ref_t) #endif } -void CompilerLogic :: injectMethodOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, ref_t flags, +void CompilerLogic :: injectMethodOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, MethodHint callType, mssg_t message, ClassInfo::MethodMap& methods, ClassAttributes& attributes, void* param, ref_t(*resolve)(void*, ref_t), ClassAttribute attribute) { - ref_t listRef = generateOverloadList(compiler, scope, flags, methods, message, param, resolve); + ref_t listRef = generateOverloadList(compiler, scope, callType, methods, message, param, resolve); ClassAttributeKey key = { message, attribute }; attributes.exclude(key); @@ -2598,7 +2610,22 @@ void CompilerLogic :: injectOverloadList(CompilerBase* compiler, ModuleScopeBase // create a new overload list mssg_t message = it.key(); - injectMethodOverloadList(compiler, scope, info.header.flags, message, + MethodHint callType = MethodHint::Normal; + if (test(info.header.flags, elSealed) || MethodInfo::checkHint(methodInfo, MethodHint::Sealed)) { + callType = MethodHint::Sealed; + } + else if (MethodInfo::checkHint(methodInfo, MethodHint::Indexed)) { + callType = MethodHint::ByIndex; + } + else if (test(message, STATIC_MESSAGE)) { + // NOTE : the check must be after the checking of indexed method to correctly deal with hidden indexed methods + callType = MethodHint::Sealed; + } + else if (test(info.header.flags, elClosed)) { + callType = MethodHint::Fixed; + } + + injectMethodOverloadList(compiler, scope, callType, message, info.methods, info.attributes, UInt32ToPtr(classRef), paramFeedback, ClassAttribute::OverloadList); } } @@ -2637,7 +2664,7 @@ mssg_t CompilerLogic :: resolveSingleDispatch(ModuleScopeBase& scope, ref_t refe mssg_t dispatcher = info.attributes.get({ weakMessage, ClassAttribute::SingleDispatch }); if (!dispatcher) { // check if it is non public message - mssg_t nonPublicWeakMessage = resolveNonpublic(weakMessage, info, selfCall, scope.isInternalOp(reference)); + mssg_t nonPublicWeakMessage = resolveNonpublic(weakMessage, info, selfCall, isInternalOp(scope, reference)); if (nonPublicWeakMessage != 0) { dispatcher = info.attributes.get({ nonPublicWeakMessage, ClassAttribute::SingleDispatch }); } @@ -3017,7 +3044,7 @@ void CompilerLogic :: importClassInfo(ClassInfo& copy, ClassInfo& target, Module info.inherited = true; // private methods are not inherited - if (!test(it.key(), STATIC_MESSAGE)) + if (!MethodInfo::checkVisibility(info, MethodHint::Private)) target.methods.add(ImportHelper::importMessage(exporter, it.key(), importer), info); } else target.methods.add(ImportHelper::importMessage(exporter, it.key(), importer), info); diff --git a/elenasrc3/elc/compilerlogic.h b/elenasrc3/elc/compilerlogic.h index 90020c3bd7..88bca2bfe9 100644 --- a/elenasrc3/elc/compilerlogic.h +++ b/elenasrc3/elc/compilerlogic.h @@ -25,6 +25,7 @@ namespace elena_lang bool withVariadicDispatcher; bool withCustomDispatcher; int nillableArgs; + mssg_t byRefHandler; }; struct TypeAttributes @@ -71,7 +72,7 @@ namespace elena_lang private: OperationMap _operations; - ref_t generateOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, ref_t flags, ClassInfo::MethodMap& methods, + ref_t generateOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, MethodHint targetType, ClassInfo::MethodMap& methods, mssg_t message, void* param, ref_t(*resolve)(void*, ref_t)); bool isSignatureCompatible(ModuleScopeBase& scope, ref_t targetSignature, ref_t* sourceSignatures, size_t sourceLen); @@ -189,6 +190,8 @@ namespace elena_lang bool checkMethod(ClassInfo& info, mssg_t message, CheckMethodResult& result); bool checkMethod(ModuleScopeBase& scope, ref_t reference, mssg_t message, CheckMethodResult& result); + mssg_t retrieveByRefHandler(ModuleScopeBase& scope, ref_t reference, mssg_t message); + // check if internal / protected / private / public message is declared bool isMessageSupported(ClassInfo& info, mssg_t message, CheckMethodResult& result); bool isMessageSupported(ClassInfo& info, mssg_t message); @@ -200,7 +203,7 @@ namespace elena_lang mssg_t resolveFunctionSingleDispatch(ModuleScopeBase& scope, ref_t reference, int& nillableArgs); void injectOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, ClassInfo& info, ref_t classRef); - void injectMethodOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, ref_t flags, + void injectMethodOverloadList(CompilerBase* compiler, ModuleScopeBase& scope, MethodHint callType, mssg_t message, ClassInfo::MethodMap& methods, ClassAttributes& attributes, void* param, ref_t(*resolve)(void*, ref_t), ClassAttribute attribute); @@ -238,6 +241,40 @@ namespace elena_lang void generateVirtualDispatchMethod(ModuleScopeBase& scope, ref_t parentRef, VirtualMethods& methods); + void retrieveTemplateNs(ModuleScopeBase& scope, ref_t reference, ReferenceProperName& templateName) + { + templateName.copyName(scope.resolveFullName(reference)); + + size_t index = (*templateName).find('#'); + templateName.cut(index, templateName.length() - index); + index = (*templateName).findLast('@'); + templateName.cut(index, templateName.length() - index); + templateName.replaceAll('@', '\'', 0); + } + + bool isTemplateInternalOp(ModuleScopeBase& scope, ref_t reference1, ref_t reference2) + { + // retrive the template namespace + ReferenceProperName templateNs; + retrieveTemplateNs(scope, reference1, templateNs); + + NamespaceString referenceNs(scope.resolveFullName(reference2)); + + return (*templateNs).compare(*referenceNs); + } + bool isInternalOp(ModuleScopeBase& scope, ref_t reference) + { + ustr_t referenceName = scope.resolveFullName(reference); + if (isWeakReference(referenceName)) { + return true; + } + else { + auto refInfo = scope.getModule(referenceName, true); + + return refInfo.module == scope.module; + } + } + CompilerLogic() : _operations({}) { @@ -279,6 +316,11 @@ namespace elena_lang static void importClassInfo(ClassInfo& copy, ClassInfo& target, ModuleBase* exporter, ModuleBase* importer, bool headerOnly, bool inheritMode/*,bool ignoreFields*/); + static bool isSealedMethod(mssg_t message, MethodInfo& info) + { + return test(message, STATIC_MESSAGE) || MethodInfo::checkType(info, MethodHint::Sealed); + } + static CompilerLogic* getInstance() { static CompilerLogic instance; diff --git a/elenasrc3/elena-tests/tests_bt_optimization.cpp b/elenasrc3/elena-tests/tests_bt_optimization.cpp index 0c711a59fa..48c16f8ba6 100644 --- a/elenasrc3/elena-tests/tests_bt_optimization.cpp +++ b/elenasrc3/elena-tests/tests_bt_optimization.cpp @@ -57,23 +57,23 @@ constexpr auto S2_Scenario1 = "class (attribute -2147479546 ()nameattr (identifi #ifdef _M_IX86 -constexpr auto BuildTree1_1 = "byrefmark -8 () local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2050 (type 4 ()) local_address -8 () copying -4 (size 4 ())"; -constexpr auto BuildTree1_2 = "byrefmark -8 () local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2242 (type 4 ()) local_address -8 () copying -4 (size 4 ())"; +constexpr auto BuildTree1_1 = "byrefmark -8 () local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2306 (type 4 ()) local_address -8 () copying -4 (size 4 ())"; +constexpr auto BuildTree1_2 = "byrefmark -8 () local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2434 (type 4 ()) local_address -8 () copying -4 (size 4 ())"; constexpr auto BuildTree2 = "int_literal 2 (value 2 ()) copying -4 ( size 4 ())"; constexpr auto BuildTree4 = "int_literal 2 (value 3 ())copying -4 (size 4 ())local_address -4 ()saving_stack ()int_literal 3 (value 2 ())saving_stack 1 ()intop 4 (index -12 ())local_address -12 ()copying -8 (size 4 ())"; -constexpr auto OptimizedBuildTree1_1 = "local_address -4 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2050 (type 4 ()) local_address -4 ()"; -constexpr auto OptimizedBuildTree1_2 = "local_address -4 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2242 (type 4 ()) local_address -4 ()"; +constexpr auto OptimizedBuildTree1_1 = "local_address -4 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2306 (type 4 ()) local_address -4 ()"; +constexpr auto OptimizedBuildTree1_2 = "local_address -4 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2434 (type 4 ()) local_address -4 ()"; constexpr auto OptimizedBuildTree2 = "saving_int - 4 (size 4 ()value 2 ())"; constexpr auto OptimizedBuildTree4 = "saving_int -4 (size 4 ()value 3 ())local_address -4 ()copying -8 (size 4 ())addingint -8 (value 2 ())"; -constexpr auto BuildTree_VariadicSingleDispatch_1 = "tape(sealed_dispatching 11 (message 3202 ()) open_frame() assigning 1 () local_reference -2 () saving_stack() varg_sop 6 (index -4 ()) unbox_call_message -2 (index 1 () length -4 () temp_var -8 () message 1089 ()) local 1 () saving_stack() argument() direct_call_op 2690 (type 5 ()) loading_index() free_varstack() close_frame() exit()) reserved 3 ()reserved_n 8 ())"; -constexpr auto BuildTree_VariadicSingleDispatch_2 = "tape(open_frame() assigning 1 () class_reference 2 () direct_call_op 544 (type 10 ()) assigning 2 () class_reference 8 () direct_call_op 544 (type 15 ()) assigning 3 () local 2 () saving_stack() argument() call_op 1089 () assigning 4 () local 3 () saving_stack() argument() call_op 1089 () assigning 5 () terminator() saving_stack 3 () local 5 () saving_stack 2 () local 4 () saving_stack 1 () class_reference 5 () saving_stack() argument() direct_call_op 2690 (type 5 ()) local 1 () close_frame() exit()) reserved 9 ()"; +constexpr auto BuildTree_VariadicSingleDispatch_1 = "tape(sealed_dispatching 11 (message 3138 ()) open_frame() assigning 1 () local_reference -2 () saving_stack() varg_sop 6 (index -4 ()) unbox_call_message -2 (index 1 () length -4 () temp_var -8 () message 1217 ()) local 1 () saving_stack() argument() direct_call_op 2626 (type 5 ()) loading_index() free_varstack() close_frame() exit()) reserved 3 ()reserved_n 8 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_2 = "tape(open_frame() assigning 1 () class_reference 2 () direct_call_op 544 (type 10 ()) assigning 2 () class_reference 8 () direct_call_op 544 (type 15 ()) assigning 3 () local 2 () saving_stack() argument() call_op 1217 () assigning 4 () local 3 () saving_stack() argument() call_op 1217 () assigning 5 () terminator() saving_stack 3 () local 5 () saving_stack 2 () local 4 () saving_stack 1 () class_reference 5 () saving_stack() argument() direct_call_op 2626 (type 5 ()) local 1 () close_frame() exit()) reserved 9 ()"; -constexpr auto BuildTree_VariadicSingleDispatch_4 = "tape (open_frame ()assigning 1 ()class_reference 8 ()direct_call_op 544 (type 16 ())assigning 2 ()class_reference 9 ()direct_call_op 544 (type 17 ())assigning 3 ()terminator ()saving_stack 3 ()local 3 ()saving_stack 2 ()local 2 ()saving_stack 1 ()class_reference 7 ()saving_stack ()argument ()direct_call_op 3714 (type 7 ())local 1 ()close_frame ()exit ())reserved 7 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_4 = "tape (open_frame ()assigning 1 ()class_reference 8 ()direct_call_op 544 (type 16 ())assigning 2 ()class_reference 9 ()direct_call_op 544 (type 17 ())assigning 3 ()terminator ()saving_stack 3 ()local 3 ()saving_stack 2 ()local 2 ()saving_stack 1 ()class_reference 7 ()saving_stack ()argument ()direct_call_op 3650 (type 7 ())local 1 ()close_frame ()exit ())reserved 7 ())"; constexpr auto BuildTree_CallMethodWithoutTarget = "tape (open_frame ()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 6 ())assigning 2 ()local 2 ()saving_stack 1 ()local 1 ()saving_stack ()argument ()direct_call_op 3074 (type 4 ())local 1 ()close_frame ()exit ())reserved 4 ()"; -constexpr auto BuildTree_CallVariadicMethodWithoutTarget = "tape(open_frame()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 2 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 3 ()local 2 ()saving_stack()argument()call_op 1089 ()assigning 4 ()local 3 ()saving_stack()argument()call_op 1089 ()assigning 5 ()terminator()saving_stack 3 ()local 5 ()saving_stack 2 ()local 4 ()saving_stack 1 ()local 1 ()saving_stack()argument()direct_call_op 3202 (type 4 ())local 1 ()close_frame()exit())reserved 9 ()"; +constexpr auto BuildTree_CallVariadicMethodWithoutTarget = "tape(open_frame()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 2 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 3 ()local 2 ()saving_stack()argument()call_op 1217 ()assigning 4 ()local 3 ()saving_stack()argument()call_op 1217 ()assigning 5 ()terminator()saving_stack 3 ()local 5 ()saving_stack 2 ()local 4 ()saving_stack 1 ()local 1 ()saving_stack()argument()direct_call_op 3138 (type 4 ())local 1 ()close_frame()exit())reserved 9 ()"; constexpr auto BuildTree_CallMethodWithNil = "tape (open_frame ()assigning 1 ()nil_reference ()saving_stack 1 ()class_reference 3 ()saving_stack ()argument ()direct_call_op 1538 (type 3 ())local 1 ()close_frame ()exit ())reserved 3 ()"; constexpr auto BuildTree_LambdaCallPrivate = "tape (open_frame ()assigning 1 ()local 1 ()field ()saving_stack ()argument ()direct_call_op 3329 (type 3 ())close_frame ()exit ())reserved 2 ()"; @@ -87,23 +87,23 @@ constexpr auto ComplexStructSize = 16; #elif _M_X64 -constexpr auto BuildTree1_1 = "byrefmark -24 () local_address -24 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2050 (type 4 ()) local_address -24 () copying -8 (size 4 ())"; -constexpr auto BuildTree1_2 = "byrefmark -24 () local_address -24 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2242 (type 4 ()) local_address -24 () copying -8 (size 4 ())"; +constexpr auto BuildTree1_1 = "byrefmark -24 () local_address -24 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2306 (type 4 ()) local_address -24 () copying -8 (size 4 ())"; +constexpr auto BuildTree1_2 = "byrefmark -24 () local_address -24 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2434 (type 4 ()) local_address -24 () copying -8 (size 4 ())"; constexpr auto BuildTree2 = "int_literal 2 (value 2 ()) copying -8 ( size 4 ())"; constexpr auto BuildTree4 = "int_literal 2 (value 3 ())copying -8 (size 4 ())local_address -8 ()saving_stack ()int_literal 3 (value 2 ())saving_stack 1 ()intop 4 (index -40 ())local_address -40 ()copying -24 (size 4 ())"; -constexpr auto OptimizedBuildTree1_1 = "local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2050 (type 4 ()) local_address -8 ()"; -constexpr auto OptimizedBuildTree1_2 = "local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2242 (type 4 ()) local_address -8 ()"; +constexpr auto OptimizedBuildTree1_1 = "local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2306 (type 4 ()) local_address -8 ()"; +constexpr auto OptimizedBuildTree1_2 = "local_address -8 () saving_stack 1 () class_reference 4 () saving_stack () argument () direct_call_op 2434 (type 4 ()) local_address -8 ()"; constexpr auto OptimizedBuildTree2 = "saving_int - 8 (size 4 ()value 2 ())"; constexpr auto OptimizedBuildTree4 = "saving_int -8 (size 4 ()value 3 ())local_address -8 ()copying -24 (size 4 ())addingint -24 (value 2 ())"; -constexpr auto BuildTree_VariadicSingleDispatch_1 = "tape(sealed_dispatching 11 (message 3202 ()) open_frame() assigning 1 () local_reference -2 () saving_stack() varg_sop 6 (index -8 ()) unbox_call_message -2 (index 1 () length -8 () temp_var -24 () message 1089 ()) local 1 () saving_stack() argument() direct_call_op 2690 (type 5 ()) loading_index() free_varstack() close_frame() exit()) reserved 4 ()reserved_n 32 ())"; -constexpr auto BuildTree_VariadicSingleDispatch_2 = "tape(open_frame() assigning 1 () class_reference 2 () direct_call_op 544 (type 10 ()) assigning 2 () class_reference 8 () direct_call_op 544 (type 15 ()) assigning 3 () local 2 () saving_stack() argument() call_op 1089 () assigning 4 () local 3 () saving_stack() argument() call_op 1089 () assigning 5 () terminator() saving_stack 3 () local 5 () saving_stack 2 () local 4 () saving_stack 1 () class_reference 5 () saving_stack() argument() direct_call_op 2690 (type 5 ()) local 1 () close_frame() exit()) reserved 10 ()"; +constexpr auto BuildTree_VariadicSingleDispatch_1 = "tape(sealed_dispatching 11 (message 3138 ()) open_frame() assigning 1 () local_reference -2 () saving_stack() varg_sop 6 (index -8 ()) unbox_call_message -2 (index 1 () length -8 () temp_var -24 () message 1217 ()) local 1 () saving_stack() argument() direct_call_op 2626 (type 5 ()) loading_index() free_varstack() close_frame() exit()) reserved 4 ()reserved_n 32 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_2 = "tape(open_frame() assigning 1 () class_reference 2 () direct_call_op 544 (type 10 ()) assigning 2 () class_reference 8 () direct_call_op 544 (type 15 ()) assigning 3 () local 2 () saving_stack() argument() call_op 1217 () assigning 4 () local 3 () saving_stack() argument() call_op 1217 () assigning 5 () terminator() saving_stack 3 () local 5 () saving_stack 2 () local 4 () saving_stack 1 () class_reference 5 () saving_stack() argument() direct_call_op 2626 (type 5 ()) local 1 () close_frame() exit()) reserved 10 ()"; -constexpr auto BuildTree_VariadicSingleDispatch_4 = "tape (open_frame ()assigning 1 ()class_reference 8 ()direct_call_op 544 (type 16 ())assigning 2 ()class_reference 9 ()direct_call_op 544 (type 17 ())assigning 3 ()terminator ()saving_stack 3 ()local 3 ()saving_stack 2 ()local 2 ()saving_stack 1 ()class_reference 7 ()saving_stack ()argument ()direct_call_op 3714 (type 7 ())local 1 ()close_frame ()exit ())reserved 8 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_4 = "tape (open_frame ()assigning 1 ()class_reference 8 ()direct_call_op 544 (type 16 ())assigning 2 ()class_reference 9 ()direct_call_op 544 (type 17 ())assigning 3 ()terminator ()saving_stack 3 ()local 3 ()saving_stack 2 ()local 2 ()saving_stack 1 ()class_reference 7 ()saving_stack ()argument ()direct_call_op 3650 (type 7 ())local 1 ()close_frame ()exit ())reserved 8 ())"; constexpr auto BuildTree_CallMethodWithoutTarget = "tape (open_frame ()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 6 ())assigning 2 ()local 2 ()saving_stack 1 ()local 1 ()saving_stack ()argument ()direct_call_op 3074 (type 4 ())local 1 ()close_frame ()exit ())reserved 4 ()"; -constexpr auto BuildTree_CallVariadicMethodWithoutTarget = "tape(open_frame()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 2 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 3 ()local 2 ()saving_stack()argument()call_op 1089 ()assigning 4 ()local 3 ()saving_stack()argument()call_op 1089 ()assigning 5 ()terminator()saving_stack 3 ()local 5 ()saving_stack 2 ()local 4 ()saving_stack 1 ()local 1 ()saving_stack()argument()direct_call_op 3202 (type 4 ())local 1 ()close_frame()exit())reserved 10 ()"; +constexpr auto BuildTree_CallVariadicMethodWithoutTarget = "tape(open_frame()assigning 1 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 2 ()class_reference 2 ()direct_call_op 544 (type 8 ())assigning 3 ()local 2 ()saving_stack()argument()call_op 1217 ()assigning 4 ()local 3 ()saving_stack()argument()call_op 1217 ()assigning 5 ()terminator()saving_stack 3 ()local 5 ()saving_stack 2 ()local 4 ()saving_stack 1 ()local 1 ()saving_stack()argument()direct_call_op 3138 (type 4 ())local 1 ()close_frame()exit())reserved 10 ()"; constexpr auto BuildTree_CallMethodWithNil = "tape (open_frame ()assigning 1 ()nil_reference ()saving_stack 1 ()class_reference 3 ()saving_stack ()argument ()direct_call_op 1538 (type 3 ())local 1 ()close_frame ()exit ())reserved 4 ()"; constexpr auto BuildTree_LambdaCallPrivate = "tape (open_frame ()assigning 1 ()local 1 ()field ()saving_stack ()argument ()direct_call_op 3329 (type 3 ())close_frame ()exit ())reserved 4 ()"; diff --git a/elenasrc3/elena-tests/tests_constructor.cpp b/elenasrc3/elena-tests/tests_constructor.cpp index 71efe22c93..b291ad38ba 100644 --- a/elenasrc3/elena-tests/tests_constructor.cpp +++ b/elenasrc3/elena-tests/tests_constructor.cpp @@ -16,12 +16,12 @@ constexpr auto S_PrivateConstructorTest = "class (nameattr (identifier \"X\" ()) #ifdef _M_IX86 -constexpr auto BuildTree_VariadicSingleDispatch_3 = "tape(open_frame()assigning 1 ()local_reference - 2 ()saving_stack()varg_sop 6 (index - 4 ())unbox_call_message - 2 (index 1 ()length - 4 ()temp_var - 8 ()message 1601 ())class_reference 6 ()saving_stack()argument()direct_call_op 4226 (type 13 ())loading_index() free_varstack() going_to_eop() close_frame()exit())reserved 3 ()reserved_n 8 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_3 = "tape(open_frame()assigning 1 ()local_reference - 2 ()saving_stack()varg_sop 6 (index - 4 ())unbox_call_message - 2 (index 1 ()length - 4 ()temp_var - 8 ()message 1729 ())class_reference 6 ()saving_stack()argument()direct_call_op 4162 (type 13 ())loading_index() free_varstack() going_to_eop() close_frame()exit())reserved 3 ()reserved_n 8 ())"; constexpr auto BuildTree_PrivateConstructorTest = "tape(open_frame() direct_call_op 800(type 6()) assigning 1 ()local -2 ()saving_stack()create_struct 4 (type 2()) copying_to_acc 2 (size 4 ()) assigning 2() local 2() saving_stack () local 1() field_assign () local 1() close_frame()exit())reserved 3 ())"; #elif _M_X64 -constexpr auto BuildTree_VariadicSingleDispatch_3 = "tape(open_frame()assigning 1 ()local_reference -2 ()saving_stack()varg_sop 6 (index -8 ())unbox_call_message -2 (index 1 ()length -8 ()temp_var -24 ()message 1601 ())class_reference 6 ()saving_stack()argument()direct_call_op 4226 (type 13 ())loading_index() free_varstack() going_to_eop() close_frame()exit())reserved 4 ()reserved_n 32 ())"; +constexpr auto BuildTree_VariadicSingleDispatch_3 = "tape(open_frame()assigning 1 ()local_reference -2 ()saving_stack()varg_sop 6 (index -8 ())unbox_call_message -2 (index 1 ()length -8 ()temp_var -24 ()message 1729 ())class_reference 6 ()saving_stack()argument()direct_call_op 4162 (type 13 ())loading_index() free_varstack() going_to_eop() close_frame()exit())reserved 4 ()reserved_n 32 ())"; constexpr auto BuildTree_PrivateConstructorTest = "tape(open_frame() direct_call_op 800(type 6()) assigning 1 ()local -2 ()saving_stack()create_struct 4 (type 2()) copying_to_acc 2 (size 4 ()) assigning 2() local 2() saving_stack () local 1() field_assign () local 1() close_frame()exit())reserved 4 ())"; #endif diff --git a/elenasrc3/elenart/elenartmachine.cpp b/elenasrc3/elenart/elenartmachine.cpp index deee3d7739..5b9b53fda6 100644 --- a/elenasrc3/elenart/elenartmachine.cpp +++ b/elenasrc3/elenart/elenartmachine.cpp @@ -139,7 +139,7 @@ int ELENARTMachine :: loadSignature(mssg_t message, addr_t* output, pos_t maxima pos_t argCount = 0; decodeMessage(message, actionRef, argCount, flags); - if (testany(message, FUNCTION_MESSAGE | CONVERSION_MESSAGE)) { + if (test(message, FUNCTION_MESSAGE) || ((message & PREFIX_MESSAGE_MASK) == CONVERSION_MESSAGE)) { argCount = _min(maximalCount, argCount); } else argCount = _min(maximalCount, argCount - 1); @@ -163,7 +163,7 @@ size_t ELENARTMachine :: loadMessageName(mssg_t message, char* buffer, size_t le IdentifierString messageName; ByteCodeUtil::formatMessageName(messageName, nullptr, *actionName, nullptr, 0, argCount, flags); - if (test(message, CONVERSION_MESSAGE)) { + if ((message & PREFIX_MESSAGE_MASK) == CONVERSION_MESSAGE) { size_t position = (*messageName).find('['); ImageSection msection(_mdata, 0x1000000); diff --git a/elenasrc3/elenavm/elenavmmachine.cpp b/elenasrc3/elenavm/elenavmmachine.cpp index 0fd65bde7b..872049f026 100644 --- a/elenasrc3/elenavm/elenavmmachine.cpp +++ b/elenasrc3/elenavm/elenavmmachine.cpp @@ -758,7 +758,7 @@ int ELENAVMMachine :: loadSignature(mssg_t message, addr_t* output, pos_t maxima pos_t argCount = 0; decodeMessage(message, actionRef, argCount, flags); - if (testany(message, FUNCTION_MESSAGE | CONVERSION_MESSAGE)) { + if (test(message, FUNCTION_MESSAGE) || ((message & PREFIX_MESSAGE_MASK) == CONVERSION_MESSAGE)) { argCount = _min(maximalCount, argCount); } else argCount = _min(maximalCount, argCount - 1); diff --git a/elenasrc3/engine/bcwriter.cpp b/elenasrc3/engine/bcwriter.cpp index 07f1caa877..33ec72dffa 100644 --- a/elenasrc3/engine/bcwriter.cpp +++ b/elenasrc3/engine/bcwriter.cpp @@ -179,6 +179,7 @@ void semiDirectCallOp(CommandTape& tape, BuildNode& node, TapeScope& tapeScope) ref_t targetRef = node.findChild(BuildKey::Type).arg.reference; bool variadicOp = (node.arg.reference & PREFIX_MESSAGE_MASK) == VARIADIC_MESSAGE; + bool indexTableMode = node.existChild(BuildKey::IndexTableMode); pos_t argCount = getArgCount(node.arg.reference); if (!variadicOp && (int)argCount < tapeScope.scope->minimalArgList) { @@ -188,6 +189,11 @@ void semiDirectCallOp(CommandTape& tape, BuildNode& node, TapeScope& tapeScope) } tape.write(ByteCode::MovM, node.arg.reference); + + // if it is an indexed call + if (indexTableMode) + tape.write(ByteCode::AltMode); + tape.write(ByteCode::VCallMR, node.arg.reference, targetRef | mskVMTRef); } @@ -495,8 +501,12 @@ void loadingIndex(CommandTape& tape, BuildNode& node, TapeScope&) void dispatchOp(CommandTape& tape, BuildNode& node, TapeScope&) { mssg_t message = node.findChild(BuildKey::Message).arg.reference; + bool altMode = node.existChild(BuildKey::IndexTableMode); if (message) { // if it is a multi-method dispatcher + if (altMode) + tape.write(ByteCode::AltMode); + tape.write(ByteCode::DispatchMR, message, node.arg.reference | mskConstArray); } // otherwise it is generic dispatcher @@ -3717,7 +3727,7 @@ void ByteCodeWriter :: saveProcedure(BuildNode node, Scope& scope, bool classMod } void ByteCodeWriter :: saveVMT(ClassInfo& info, BuildNode node, Scope& scope, pos_t sourcePathRef, - ReferenceMap& paths, bool tapeOptMode) + ReferenceMap& paths, bool tapeOptMode, IndexedMessages& indexedMessages) { BuildNode current = node.firstChild(); while (current != BuildKey::None) { @@ -3725,6 +3735,8 @@ void ByteCodeWriter :: saveVMT(ClassInfo& info, BuildNode node, Scope& scope, po pos_t methodSourcePathRef = sourcePathRef; auto methodInfo = info.methods.get(current.arg.reference); + if (MethodInfo::checkHint(methodInfo, MethodHint::Indexed)) + indexedMessages.add(current.arg.reference); MethodEntry entry = { current.arg.reference, scope.code->position(), methodInfo.outputRef }; scope.vmt->write(&entry, sizeof(MethodEntry)); @@ -3736,12 +3748,26 @@ void ByteCodeWriter :: saveVMT(ClassInfo& info, BuildNode node, Scope& scope, po saveProcedure(current, scope, true, methodSourcePathRef, paths, tapeOptMode); } else if (current == BuildKey::AbstractMethod) { + auto methodInfo = info.methods.get(current.arg.reference); + if (MethodInfo::checkHint(methodInfo, MethodHint::Indexed)) + indexedMessages.add(current.arg.reference); + MethodEntry entry = { current.arg.reference, INVALID_POS }; scope.vmt->write(&entry, sizeof(MethodEntry)); } current = current.nextNode(); } + +} + +void ByteCodeWriter :: saveIndexTable(Scope& scope, IndexedMessages& indexedMessages) +{ + // saving indexes terminated with 0 + for (pos_t i = 0; i < indexedMessages.count_pos(); i++) + scope.vmt->writeDWord(indexedMessages[i]); + + scope.vmt->writeDWord(0); } pos_t ByteCodeWriter :: savePath(BuildNode node, Scope& scope, ReferenceMap& paths) @@ -3777,19 +3803,25 @@ void ByteCodeWriter :: saveClass(BuildNode node, SectionScopeBase* moduleScope, ClassInfo info; info.load(&metaReader); - // reset VMT length + // reset VMT & HMT lengths info.header.count = 0; + info.header.indexCount = 0; for (auto m_it = info.methods.start(); !m_it.eof(); ++m_it) { auto m_info = *m_it; //NOTE : ingnore statically linked and predefined methods if (!test(m_it.key(), STATIC_MESSAGE) && !test(m_info.hints, (ref_t)MethodHint::Predefined)) info.header.count++; + + //NOTE : count indexed methods + if (MethodInfo::checkHint(m_info, MethodHint::Indexed)) + info.header.indexCount++; } vmtWriter.write(&info.header, sizeof(ClassHeader)); // header Scope scope = { &vmtWriter, &codeWriter, moduleScope, nullptr, nullptr, minimalArgList, ptrSize }; + IndexedMessages indexedMessages; if (moduleScope->debugModule) { // initialize debug info writers MemoryWriter debugWriter(moduleScope->debugModule->mapSection(DEBUG_LINEINFO_ID, false)); @@ -3802,14 +3834,16 @@ void ByteCodeWriter :: saveClass(BuildNode node, SectionScopeBase* moduleScope, openClassDebugInfo(scope, moduleScope->module->resolveReference(node.arg.reference & ~mskAnyRef), info.header.flags); saveFieldDebugInfo(scope, info); - saveVMT(info, node, scope, sourcePath, paths, tapeOptMode); + saveVMT(info, node, scope, sourcePath, paths, tapeOptMode, indexedMessages); endDebugInfo(scope); } - else saveVMT(info, node, scope, INVALID_POS, paths, tapeOptMode); + else saveVMT(info, node, scope, INVALID_POS, paths, tapeOptMode, indexedMessages); pos_t size = vmtWriter.position() - classPosition; vmtSection->write(classPosition - 4, &size, sizeof(size)); + saveIndexTable(scope, indexedMessages); + ClassInfo::saveStaticFields(&vmtWriter, info.statics); CachedList globalAttributes; diff --git a/elenasrc3/engine/bcwriter.h b/elenasrc3/engine/bcwriter.h index 189d6e24bb..8f82dc0767 100644 --- a/elenasrc3/engine/bcwriter.h +++ b/elenasrc3/engine/bcwriter.h @@ -32,7 +32,8 @@ namespace elena_lang int ptrSize; }; - typedef Stack> LoopLabels; + typedef Stack> LoopLabels; + typedef CachedList IndexedMessages; struct TapeScope { @@ -125,7 +126,8 @@ namespace elena_lang ReferenceMap& paths, bool tapeOptMode); void saveVMT(ClassInfo& info, BuildNode node, Scope& scope, pos_t sourcePathRef, ReferenceMap& paths, - bool tapeOptMod); + bool tapeOptMod, IndexedMessages& indexes); + void saveIndexTable(Scope& scope, IndexedMessages& indexes); void saveSymbol(BuildNode node, SectionScopeBase* moduleScope, int minimalArgList, int ptrSize, ReferenceMap& paths, bool tapeOptMode); diff --git a/elenasrc3/engine/buildtree.h b/elenasrc3/engine/buildtree.h index a2a2de62eb..f86ee9f3c9 100644 --- a/elenasrc3/engine/buildtree.h +++ b/elenasrc3/engine/buildtree.h @@ -239,6 +239,7 @@ namespace elena_lang Source = 0x8012, Length = 0x8013, TempVar = 0x8014, + IndexTableMode = 0x8015, Idle = 0x8FFF, diff --git a/elenasrc3/engine/bytecode.cpp b/elenasrc3/engine/bytecode.cpp index c8ce5e6905..c1e88b20d8 100644 --- a/elenasrc3/engine/bytecode.cpp +++ b/elenasrc3/engine/bytecode.cpp @@ -23,7 +23,7 @@ const char* _fnOpcodes[256] = "coalesce", "not", "neg", "bread", "lsave", "fsave", "wread", "xjump", "bcopy", "wcopy", "xpeekeq", "trylock", "freelock", "parent", "xget", "xcall", - "xfsave", OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, "xquit", OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, + "xfsave", "altmode", OPCODE_UNKNOWN, OPCODE_UNKNOWN, "xquit", OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, OPCODE_UNKNOWN, diff --git a/elenasrc3/engine/bytecode.h b/elenasrc3/engine/bytecode.h index 313174b66b..218c2c7330 100644 --- a/elenasrc3/engine/bytecode.h +++ b/elenasrc3/engine/bytecode.h @@ -70,6 +70,7 @@ namespace elena_lang XCall = 0x2F, XFSave = 0x30, + AltMode = 0x31, XQuit = 0x34, FIAdd = 0x70, diff --git a/elenasrc3/engine/elena.h b/elenasrc3/engine/elena.h index 2634c09af0..c275705e56 100644 --- a/elenasrc3/engine/elena.h +++ b/elenasrc3/engine/elena.h @@ -533,6 +533,7 @@ namespace elena_lang addr_t outputListAddress; ref_t flags; pos_t count; + pos_t indexCount; }; virtual void prepare( @@ -564,12 +565,15 @@ namespace elena_lang virtual pos_t getVMTLength(void* targetVMT) = 0; virtual addr_t findMethodAddress(void* entries, mssg_t message) = 0; virtual pos_t findMethodOffset(void* entries, mssg_t message) = 0; + virtual pos_t findHiddenMethodOffset(void* entries, mssg_t message) = 0; virtual void allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, - pos_t staticLength, bool withOutputList) = 0; + pos_t indexTableLength, pos_t staticLength, bool withOutputList) = 0; virtual void addVMTEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t& entryCount) = 0; + virtual void addIndexEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t indexOffset, pos_t& indexCount) = 0; + virtual void updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixInfo, FieldAddressMap& staticValues, bool virtualMode) = 0; - virtual pos_t copyParentVMT(void* parentVMT, void* targetVMT) = 0; + virtual Pair copyParentVMT(void* parentVMT, void* targetVMT, pos_t indexTableOffset) = 0; virtual void allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length, bool structMode, bool virtualMode) = 0; @@ -975,11 +979,19 @@ namespace elena_lang public: ustr_t operator*() const { return ustr_t(_string); } - ReferenceProperName(ustr_t referenceName) + void copyName(ustr_t referenceName) { size_t pos = referenceName.findLast('\'', 0); copy(referenceName.str() + pos + 1); } + + ReferenceProperName(ustr_t referenceName) + { + copyName(referenceName); + } + ReferenceProperName() + { + } }; // --- ReferenceName --- @@ -1109,6 +1121,7 @@ namespace elena_lang pos_t staticSize; // static table size ref_t classRef; // class class reference pos_t count; + pos_t indexCount; ref_t flags; ref_t parentRef; }; diff --git a/elenasrc3/engine/elenaconst.h b/elenasrc3/engine/elenaconst.h index 39e9be1512..71978e3989 100644 --- a/elenasrc3/engine/elenaconst.h +++ b/elenasrc3/engine/elenaconst.h @@ -13,7 +13,7 @@ namespace elena_lang { // --- Common ELENA Engine constants --- #define ENGINE_MAJOR_VERSION 6 // ELENA Engine version - #define ENGINE_MINOR_VERSION 4 + #define ENGINE_MINOR_VERSION 5 constexpr auto LINE_LEN = 0x1000; // the maximal source line length constexpr auto IDENTIFIER_LEN = 0x0300; // the maximal identifier length @@ -26,11 +26,11 @@ namespace elena_lang constexpr auto MESSAGE_FLAG_MASK = 0x1E0u; constexpr auto STATIC_MESSAGE = 0x100u; - constexpr auto FUNCTION_MESSAGE = 0x020u; // indicates it is an invoke message (without target variable in the call stack) - constexpr auto CONVERSION_MESSAGE = 0x040u; - constexpr auto VARIADIC_MESSAGE = 0x080u; - constexpr auto PROPERTY_MESSAGE = 0x0C0u; - constexpr auto PREFIX_MESSAGE_MASK = 0x0C0u; // HOTFIX : is used to correctly identify VARIADIC_MESSAGE or PROPERTY_MESSAGE + constexpr auto FUNCTION_MESSAGE = 0x020u; + constexpr auto VARIADIC_MESSAGE = 0x040u; + constexpr auto PROPERTY_MESSAGE = 0x080u; + constexpr auto CONVERSION_MESSAGE = 0x0C0u; + constexpr auto PREFIX_MESSAGE_MASK = 0x0C0u; // HOTFIX : is used to correctly identify VARIADIC_MESSAGE / PROPERTY_MESSAGE / CONVERSION_MESSAGE constexpr auto ARG_COUNT = 0x01Eu; constexpr auto ARG_MASK = 0x01Fu; @@ -38,7 +38,7 @@ namespace elena_lang // --- ELENA Module structure constants --- constexpr auto ELENA_SIGNITURE = "ELENA."; // the stand alone image constexpr auto ELENA_VM_SIGNITURE = "VM.ELENA."; // the stand alone image - constexpr auto MODULE_SIGNATURE = "ELENA.0604"; // the module version + constexpr auto MODULE_SIGNATURE = "ELENA.0605"; // the module version constexpr auto DEBUG_MODULE_SIGNATURE = "ED.06"; // --- ELENA core module names --- @@ -57,6 +57,7 @@ namespace elena_lang constexpr auto WEAK_POSTFIX = "#weak"; constexpr auto ENUM_POSTFIX = "#enum"; + constexpr auto BYREF_POSTFIX = "#byref"; constexpr auto NAMESPACE_REF = "$namespace"; @@ -65,59 +66,10 @@ namespace elena_lang constexpr auto ROOT_MODULE = "$rootnamespace"; // The project namespace // --- ELENA standard forwards + constexpr auto FORWARD_PREFIX_NS = "$forwards'"; constexpr auto TEMPLATE_PREFIX_NS = "'$auto'"; constexpr auto TEMPLATE_PREFIX_NS_ENCODED = "@$auto@"; - constexpr auto FORWARD_PREFIX_NS = "$forwards'"; constexpr auto AUTO_SYMBOL_PREFIX = "@autosymbol"; - constexpr auto INLINE_CLASSNAME = "$inline"; // nested class generic name - - constexpr auto OPERATION_MAP_KEY = "statements"; - constexpr auto PREDEFINED_MAP_KEY = "defaults"; - constexpr auto ATTRIBUTES_MAP_KEY = "attributes"; - constexpr auto ALIASES_MAP_KEY = "aliases"; - - constexpr auto OPERATION_MAP = "system@operations@statements"; - constexpr auto PREDEFINED_MAP = "system@predefined@defaults"; - constexpr auto ATTRIBUTES_MAP = "system@attributes@attributes"; - constexpr auto ALIASES_MAP = "system@predefined@aliases"; - - constexpr auto STARTUP_ENTRY = "$auto'startUpSymbol"; - - constexpr auto VM_TAPE = "$elena'meta$startUpTape"; - - constexpr auto PROGRAM_ENTRY = "$forwards'program"; // used by the linker to define the debug entry - - constexpr auto SYSTEM_FORWARD = "$system_entry"; // the system entry - constexpr auto SUPER_FORWARD = "$super"; // the common class predecessor - constexpr auto NILVALUE_FORWARD = "$nil"; // the nil value - constexpr auto INTLITERAL_FORWARD = "$int"; // the int literal - constexpr auto LONGLITERAL_FORWARD = "$long"; // the long literal - constexpr auto REALLITERAL_FORWARD = "$real"; // the real literal - constexpr auto INT8LITERAL_FORWARD = "$int8"; // the int literal - constexpr auto UINT8LITERAL_FORWARD = "$uint8"; // the int literal - constexpr auto INT16LITERAL_FORWARD = "$short"; // the int literal - constexpr auto UINT16LITERAL_FORWARD = "$ushort"; // the int literal - constexpr auto LITERAL_FORWARD = "$string"; // the string literal - constexpr auto WIDELITERAL_FORWARD = "$wide"; // the wide string literal - constexpr auto CHAR_FORWARD = "$char"; // the char literal - constexpr auto BOOL_FORWARD = "$boolean"; // the boolean class - constexpr auto TRUE_FORWARD = "$true"; // the true boolean value - constexpr auto FALSE_FORWARD = "$false"; // the false boolean value - constexpr auto WRAPPER_FORWARD = "$ref"; // the wrapper template - constexpr auto ARRAY_FORWARD = "$array"; // the array template - constexpr auto VARIADIC_ARRAY_FORWARD = "$varray"; // the array template - constexpr auto MESSAGE_FORWARD = "$message"; // the message class - constexpr auto MESSAGE_NAME_FORWARD = "$subject"; // the message class - constexpr auto EXT_MESSAGE_FORWARD = "$ext_message"; // the extension message class - constexpr auto CLOSURE_FORWARD = "$closure"; // the closure template class - constexpr auto TUPLE_FORWARD = "$tuple"; // the tuple template class - constexpr auto YIELDIT_FORWARD = "$yieldit"; // the yield state machine iterator template class - constexpr auto UINT_FORWARD = "$uint"; // the uint wrapper - constexpr auto PTR_FORWARD = "$ptr"; // the ptr wrapper - constexpr auto LAZY_FORWARD = "$lazy"; - constexpr auto NULLABLE_FORWARD = "$nullable"; - constexpr auto PRELOADED_FORWARD = "system@preloadedSymbols"; - constexpr auto START_FORWARD = "$symbol_entry"; // --- ELENA section prefixes constexpr auto META_PREFIX = "meta$"; @@ -153,6 +105,7 @@ namespace elena_lang constexpr auto NEXT_MESSAGE = "next"; constexpr auto CURRENT_FIELD = "__current"; + constexpr auto PROCEED_MESSAGE = "proceed"; constexpr auto ADD_MESSAGE = "add"; constexpr auto SUB_MESSAGE = "subtract"; @@ -379,30 +332,31 @@ namespace elena_lang constexpr ref_t mskLiteralRef = 0x0E000000u; // reference to constant literal constexpr ref_t mskVMTMethodAddress = 0x0F000000u; constexpr ref_t mskVMTMethodOffset = 0x10000000u; - constexpr ref_t mskConstArray = 0x11000000u; - constexpr ref_t mskMessageBodyRef = 0x12000000u; - constexpr ref_t mskMetaSymbolInfoRef = 0x13000000u; - constexpr ref_t mskDeclAttributesRef = 0x14000000u; - constexpr ref_t mskMetaExtensionRef = 0x15000000u; - constexpr ref_t mskStaticRef = 0x16000000u; - constexpr ref_t mskCharacterRef = 0x17000000u; // reference to character literal - constexpr ref_t mskConstant = 0x18000000u; - constexpr ref_t mskStaticVariable = 0x19000000u; - constexpr ref_t mskNameLiteralRef = 0x1A000000u; - constexpr ref_t mskPathLiteralRef = 0x1B000000u; - constexpr ref_t mskMssgLiteralRef = 0x1C000000u; - constexpr ref_t mskLabelRef = 0x1D000000u; - constexpr ref_t mskWideLiteralRef = 0x1E000000u; // reference to wide literal constant - constexpr ref_t mskStringMapRef = 0x1F000000u; - constexpr ref_t mskLongLiteralRef = 0x20000000u; - constexpr ref_t mskRealLiteralRef = 0x21000000u; - constexpr ref_t mskExtMssgLiteralRef = 0x22000000u; - constexpr ref_t mskPSTRRef = 0x23000000u; - constexpr ref_t mskAutoSymbolRef = 0x24000000u; - constexpr ref_t mskMssgNameLiteralRef = 0x25000000u; - constexpr ref_t mskPackageRef = 0x26000000u; - constexpr ref_t mskDistrTypeListRef = 0x27000000u; - constexpr ref_t mskTLSVariable = 0x28000000u; + constexpr ref_t mskHMTMethodOffset = 0x11000000u; + constexpr ref_t mskConstArray = 0x12000000u; + constexpr ref_t mskMessageBodyRef = 0x13000000u; + constexpr ref_t mskMetaSymbolInfoRef = 0x14000000u; + constexpr ref_t mskDeclAttributesRef = 0x15000000u; + constexpr ref_t mskMetaExtensionRef = 0x16000000u; + constexpr ref_t mskStaticRef = 0x17000000u; + constexpr ref_t mskCharacterRef = 0x18000000u; // reference to character literal + constexpr ref_t mskConstant = 0x19000000u; + constexpr ref_t mskStaticVariable = 0x1A000000u; + constexpr ref_t mskNameLiteralRef = 0x1B000000u; + constexpr ref_t mskPathLiteralRef = 0x1C000000u; + constexpr ref_t mskMssgLiteralRef = 0x1D000000u; + constexpr ref_t mskLabelRef = 0x1E000000u; + constexpr ref_t mskWideLiteralRef = 0x1F000000u; // reference to wide literal constant + constexpr ref_t mskStringMapRef = 0x20000000u; + constexpr ref_t mskLongLiteralRef = 0x21000000u; + constexpr ref_t mskRealLiteralRef = 0x22000000u; + constexpr ref_t mskExtMssgLiteralRef = 0x23000000u; + constexpr ref_t mskPSTRRef = 0x24000000u; + constexpr ref_t mskAutoSymbolRef = 0x25000000u; + constexpr ref_t mskMssgNameLiteralRef = 0x26000000u; + constexpr ref_t mskPackageRef = 0x27000000u; + constexpr ref_t mskDistrTypeListRef = 0x28000000u; + constexpr ref_t mskTLSVariable = 0x29000000u; // --- Image reference types --- constexpr ref_t mskCodeRef = 0x01000000u; diff --git a/elenasrc3/engine/jitcompiler.cpp b/elenasrc3/engine/jitcompiler.cpp index be0445686b..854e45816a 100644 --- a/elenasrc3/engine/jitcompiler.cpp +++ b/elenasrc3/engine/jitcompiler.cpp @@ -27,7 +27,7 @@ CodeGenerator _codeGenerators[256] = loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, loadOp, - loadOp, loadNop, loadNop, loadNop, loadOp, loadNop, loadNop, loadNop, + loadOp, compileAltMode, loadNop, loadNop, loadOp, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, loadNop, @@ -2094,7 +2094,9 @@ void elena_lang::loadVMTROp(JITCompilerScope* scope) { MemoryWriter* writer = scope->codeWriter; - void* code = scope->compiler->_inlines[0][scope->code()]; + int codeIndex = scope->altMode ? 6 : 0; + + void* code = scope->compiler->_inlines[codeIndex][scope->code()]; pos_t position = writer->position(); pos_t length = *(pos_t*)((char*)code - sizeof(pos_t)); @@ -2103,6 +2105,8 @@ void elena_lang::loadVMTROp(JITCompilerScope* scope) // simply copy correspondent inline code writer->write(code, length); + int argMask = scope->getAltMode() ? mskHMTMethodOffset : mskVMTMethodOffset; + // resolve section references pos_t count = *(pos_t*)((char*)code + length); RelocationEntry* entries = (RelocationEntry*)((char*)code + length + sizeof(pos_t)); @@ -2111,15 +2115,15 @@ void elena_lang::loadVMTROp(JITCompilerScope* scope) writer->seek(position + entries->offset); switch (entries->reference) { case ARG32_1: - scope->compiler->writeVMTMethodArg(scope, arg2 | mskVMTMethodOffset, + scope->compiler->writeVMTMethodArg(scope, arg2 | argMask, 0, scope->helper->importMessage(scope->command.arg1), mskRef32); break; case ARG12_1: - scope->compiler->writeVMTMethodArg(scope, arg2 | mskVMTMethodOffset, + scope->compiler->writeVMTMethodArg(scope, arg2 | argMask, 0, scope->helper->importMessage(scope->command.arg1), mskRef32Lo12); break; case ARG16_1: - scope->compiler->writeVMTMethodArg(scope, arg2 | mskVMTMethodOffset, + scope->compiler->writeVMTMethodArg(scope, arg2 | argMask, 0, scope->helper->importMessage(scope->command.arg1), mskRef32Lo); break; default: @@ -2690,6 +2694,11 @@ void elena_lang::compileBreakpoint(JITCompilerScope* scope) scope->helper->addBreakpoint(*scope->codeWriter); } +void elena_lang::compileAltMode(JITCompilerScope* scope) +{ + scope->altMode = true; +} + void elena_lang::compileJump(JITCompilerScope* scope) { pos_t label = scope->tapeReader->position() + scope->command.arg1; @@ -2786,18 +2795,19 @@ void elena_lang::compileDispatchMR(JITCompilerScope* scope) MemoryWriter* writer = scope->codeWriter; bool functionMode = test((unsigned int)scope->command.arg1, FUNCTION_MESSAGE); + int altModifier = scope->altMode ? 6 : 0; void* code = nullptr; if ((scope->command.arg1 & PREFIX_MESSAGE_MASK) == VARIADIC_MESSAGE) { if (!scope->command.arg2) { code = scope->compiler->_inlines[10][scope->code()]; } - else code = scope->compiler->_inlines[5][scope->code()]; + else code = scope->compiler->_inlines[5 + altModifier][scope->code()]; } else if (!scope->command.arg2) { code = scope->compiler->_inlines[9][scope->code()]; } - else code = scope->compiler->_inlines[0][scope->code()]; + else code = scope->compiler->_inlines[0 + altModifier][scope->code()]; pos_t position = writer->position(); pos_t length = *(pos_t*)((char*)code - sizeof(pos_t)); @@ -2889,6 +2899,7 @@ JITCompilerScope :: JITCompilerScope(ReferenceHelperBase* helper, JITCompiler* c this->frameOffset = 0; this->withDebugInfo = compiler->isWithDebugInfo(); this->inlineMode = false; + this->altMode = false; } // --- JITCompiler --- @@ -3188,7 +3199,7 @@ void JITCompiler32 :: compileMetaList(ReferenceHelperBase* helper, MemoryReader& } void JITCompiler32 :: allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, - pos_t staticLength, bool withOutputList) + pos_t indexTableLength, pos_t staticLength, bool withOutputList) { // create VMT static table vmtWriter.writeBytes(0, staticLength << 2); @@ -3202,9 +3213,11 @@ void JITCompiler32 :: allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vm pos_t position = vmtWriter.position(); pos_t vmtSize = 0; - if (test(flags, elStandartVMT)) - // + VMT length + if (test(flags, elStandartVMT)) { + // VMT length + (IT length + 1) vmtSize = vmtLength * sizeof(VMTEntry32); + vmtSize += (indexTableLength + 1) * sizeof(VMTEntry32); + } vmtWriter.writeBytes(0, vmtSize); @@ -3253,8 +3266,29 @@ pos_t JITCompiler32 :: findMethodOffset(void* entries, mssg_t message) return offset; } -pos_t JITCompiler32 :: copyParentVMT(void* parentVMT, void* targetVMT) +pos_t JITCompiler32 :: findHiddenMethodOffset(void* entries, mssg_t message) { + VMTHeader32* header = (VMTHeader32*)((uintptr_t)entries - elVMTClassOffset32); + + // NOTE : hidden table follows the main method table + pos_t i = header->count; + while (((VMTEntry32*)entries)[i].message) { + if (((VMTEntry32*)entries)[i].message == message) { + return (i - header->count) * sizeof(VMTEntry32); + } + + i++; + } + // must not reach this point + assert(false); + + return 0; +} + +Pair JITCompiler32 :: copyParentVMT(void* parentVMT, void* targetVMT, pos_t indexTableOffset) +{ + Pair counters = {}; + if (parentVMT) { // get the parent vmt size VMTHeader32* header = (VMTHeader32*)((uintptr_t)parentVMT - elVMTClassOffset32); @@ -3267,9 +3301,18 @@ pos_t JITCompiler32 :: copyParentVMT(void* parentVMT, void* targetVMT) ((VMTEntry32*)targetVMT)[i] = parentEntries[i]; } - return header->count; + // copy parent Index Table + pos_t indexCount = 0; + while (((VMTEntry32*)parentEntries)[header->count + indexCount].message) { + ((VMTEntry32*)targetVMT)[indexTableOffset + indexCount] = parentEntries[header->count + indexCount]; + + indexCount++; + } + + counters.value1 =header->count; + counters.value2 = indexCount; } - else return 0; + return counters; } void JITCompiler32 :: allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length, @@ -3313,6 +3356,44 @@ void JITCompiler32 :: addVMTEntry(mssg_t message, addr_t codeAddress, void* targ entries[index].address = (pos_t)codeAddress; } +inline addr_t findEntryAddress(VMTEntry32* entries, mssg_t message, pos_t counter) +{ + for (pos_t i = 0; i < counter; i++) { + if (entries[i].message == message) + return entries[i].address; + } + + assert(false); + return INVALID_ADDR; +} + +void JITCompiler32 :: addIndexEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t indexOffset, pos_t& indexCount) +{ + VMTEntry32* entries = (VMTEntry32*)targetVMT; + + pos_t index = indexOffset; + while (entries[index].message) { + if (entries[index].message == message) { + if (codeAddress == INVALID_ADDR) { + entries[index].address = findEntryAddress(entries, message, indexOffset); + } + else entries[index].address = (pos_t)codeAddress; + + return; + } + + index++; + } + + entries[index].message = message; + if (codeAddress == INVALID_ADDR) { + entries[index].address = findEntryAddress(entries, message, indexOffset); + } + else entries[index].address = (pos_t)codeAddress; + + indexCount++; +} + void JITCompiler32 :: updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixInfo, FieldAddressMap& staticValues, bool virtualMode) { @@ -3351,6 +3432,14 @@ void JITCompiler32 :: updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixIn entryPosition += 8; } + + // fix index table + for (pos_t i = 0; i < fixInfo.indexCount; i++) { + if (MemoryBase::getDWord(image, entryPosition + 4)) + image->addReference(mskCodeRef32, entryPosition + 4); + + entryPosition += 8; + } } // settings static values @@ -3654,7 +3743,7 @@ void JITCompiler64 :: compileOutputTypeList(ReferenceHelperBase* helper, MemoryW } void JITCompiler64 :: allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, - pos_t staticLength, bool withOutputList) + pos_t indexTableLength, pos_t staticLength, bool withOutputList) { // create VMT static table vmtWriter.writeBytes(0, staticLength << 3); @@ -3668,9 +3757,11 @@ void JITCompiler64 :: allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vm pos_t position = vmtWriter.position(); pos_t vmtSize = 0; - if (test(flags, elStandartVMT)) - // + VMT length + if (test(flags, elStandartVMT)) { + // VMT length + (IT length + 1) vmtSize = vmtLength * sizeof(VMTEntry64); + vmtSize += (indexTableLength + 1) * sizeof(VMTEntry64); + } vmtWriter.writeBytes(0, vmtSize); @@ -3726,8 +3817,30 @@ pos_t JITCompiler64 :: findMethodOffset(void* entries, mssg_t message) return offset; } -pos_t JITCompiler64 :: copyParentVMT(void* parentVMT, void* targetVMT) +pos_t JITCompiler64 :: findHiddenMethodOffset(void* entries, mssg_t message) { + VMTHeader64* header = (VMTHeader64*)((uintptr_t)entries - elVMTClassOffset64); + + // NOTE : hidden table follows the main method table + pos64_t i = header->count; + while (((VMTEntry64*)entries)[i].message) { + if (((VMTEntry64*)entries)[i].message == message) { + return static_cast((i - header->count) * sizeof(VMTEntry64)); + } + + i++; + } + + // must not reach this point + assert(false); + + return 0; +} + +Pair JITCompiler64 :: copyParentVMT(void* parentVMT, void* targetVMT, pos_t indexTableOffset) +{ + Pair counters = {}; + if (parentVMT) { // get the parent vmt size VMTHeader64* header = (VMTHeader64*)((uintptr_t)parentVMT - elVMTClassOffset64); @@ -3740,9 +3853,18 @@ pos_t JITCompiler64 :: copyParentVMT(void* parentVMT, void* targetVMT) ((VMTEntry64*)targetVMT)[i] = parentEntries[i]; } - return (pos_t)header->count; + // copy parent Index Table + pos_t indexCount = 0; + while (((VMTEntry64*)parentEntries)[header->count + indexCount].message) { + ((VMTEntry64*)targetVMT)[indexTableOffset + indexCount] = parentEntries[header->count + indexCount]; + + indexCount++; + } + + counters.value1 = static_cast(header->count); + counters.value2 = indexCount; } - else return 0; + return counters; } void JITCompiler64 :: addVMTEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t& entryCount) @@ -3767,6 +3889,44 @@ void JITCompiler64 :: addVMTEntry(mssg_t message, addr_t codeAddress, void* targ entries[index].address = codeAddress; } +inline addr_t findEntryAddress(VMTEntry64* entries, mssg_t message, pos_t counter) +{ + for (pos_t i = 0; i < counter; i++) { + if (entries[i].message == message) + return (addr_t)entries[i].address; + } + + assert(false); + return INVALID_ADDR; +} + +void JITCompiler64 :: addIndexEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t indexOffset, pos_t& indexCount) +{ + VMTEntry64* entries = (VMTEntry64*)targetVMT; + + pos_t index = indexOffset; + while (entries[index].message) { + if (entries[index].message == message) { + if (codeAddress == INVALID_ADDR) { + entries[index].address = findEntryAddress(entries, message, indexOffset); + } + else entries[index].address = codeAddress; + + return; + } + + index++; + } + + entries[index].message = message; + if (codeAddress == INVALID_ADDR) { + entries[index].address = findEntryAddress(entries, message, indexOffset); + } + else entries[index].address = codeAddress; + + indexCount++; +} + void JITCompiler64 :: updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixInfo, FieldAddressMap& staticValues, bool virtualMode) { pos_t position = vmtWriter.position(); @@ -3800,6 +3960,14 @@ void JITCompiler64 :: updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixIn entryPosition += 16; } + + // fix index table + for (pos_t i = 0; i < fixInfo.indexCount; i++) { + if (MemoryBase::getDWord(image, entryPosition + 8)) + image->addReference(mskCodeRef64, entryPosition + 8); + + entryPosition += 16; + } } // settings static values diff --git a/elenasrc3/engine/jitcompiler.h b/elenasrc3/engine/jitcompiler.h index ac96123445..bca32e16a6 100644 --- a/elenasrc3/engine/jitcompiler.h +++ b/elenasrc3/engine/jitcompiler.h @@ -53,6 +53,15 @@ namespace elena_lang bool withDebugInfo; ref_t frameOffset; ref_t stackOffset; + bool altMode; + + bool getAltMode() + { + bool oriValue = altMode; + altMode = false; + + return oriValue; + } unsigned char code() const { @@ -145,6 +154,7 @@ namespace elena_lang friend void compileAlloc(JITCompilerScope* scope); friend void compileFree(JITCompilerScope* scope); friend void compileBreakpoint(JITCompilerScope* scope); + friend void compileAltMode(JITCompilerScope* scope); friend void compileClose(JITCompilerScope* scope); friend void compileOpen(JITCompilerScope* scope); friend void compileExtOpen(JITCompilerScope* scope); @@ -274,12 +284,14 @@ namespace elena_lang pos_t getVMTLength(void* targetVMT) override; addr_t findMethodAddress(void* entries, mssg_t message) override; pos_t findMethodOffset(void* entries, mssg_t message) override; + pos_t findHiddenMethodOffset(void* entries, mssg_t message) override; void allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, - pos_t staticLength, bool withOutputList) override; + pos_t indexTableLength, pos_t staticLength, bool withOutputList) override; void addVMTEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t& entryCount) override; + void addIndexEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t indexOffset, pos_t& indexCount) override; void updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixInfo, FieldAddressMap& staticValues, bool virtualMode) override; - pos_t copyParentVMT(void* parentVMT, void* targetVMT) override; + Pair copyParentVMT(void* parentVMT, void* targetVMT, pos_t indexTableOffset) override; void allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length, bool structMode, bool virtualMode) override; @@ -352,11 +364,13 @@ namespace elena_lang pos_t getVMTLength(void* targetVMT) override; addr_t findMethodAddress(void* entries, mssg_t message) override; pos_t findMethodOffset(void* entries, mssg_t message) override; + pos_t findHiddenMethodOffset(void* entries, mssg_t message) override; void allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, - pos_t staticLength, bool withOutputList) override; - pos_t copyParentVMT(void* parentVMT, void* targetVMT) override; + pos_t indexTableLength, pos_t staticLength, bool withOutputList) override; + Pair copyParentVMT(void* parentVMT, void* targetVMT, pos_t indexTableOffset) override; void addVMTEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t& entryCount) override; + void addIndexEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t indexOffset, pos_t& indexCount) override; void updateVMTHeader(MemoryWriter& vmtWriter, VMTFixInfo& fixInfo, FieldAddressMap& staticValues, bool virtualMode) override; void allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length, @@ -455,6 +469,7 @@ namespace elena_lang void compileExtOpen(JITCompilerScope* scope); void compileXOpen(JITCompilerScope* scope); void compileBreakpoint(JITCompilerScope* scope); + void compileAltMode(JITCompilerScope* scope); void compileJump(JITCompilerScope* scope); void compileJeq(JITCompilerScope* scope); void compileJne(JITCompilerScope* scope); diff --git a/elenasrc3/engine/jitlinker.cpp b/elenasrc3/engine/jitlinker.cpp index f919436cc1..a3e252b819 100644 --- a/elenasrc3/engine/jitlinker.cpp +++ b/elenasrc3/engine/jitlinker.cpp @@ -241,6 +241,18 @@ void JITLinker::JITLinkerReferenceHelper :: writeSectionReference(MemoryBase* im pos_t offset = _owner->resolveVMTMethodOffset(sectionInfo->module, currentRef, message); _owner->fixOffset(imageOffset, addressMask, offset, image); } + else if (currentMask == mskHMTMethodOffset) { + _owner->resolve( + _owner->_loader->retrieveReferenceInfo(sectionInfo->module, currentRef, mskVMTRef, + _owner->_forwardResolver), mskVMTRef, false); + + // message id should be replaced with an appropriate method address + mssg_t message = _owner->createMessage(sectionInfo->module, + MemoryBase::getDWord(section, sectionOffset), *_references); + + pos_t offset = _owner->resolveHiddenMTMethodOffset(sectionInfo->module, currentRef, message); + _owner->fixOffset(imageOffset, addressMask, offset, image); + } else if (currentMask == mskVMTMethodAddress) { _owner->resolve( _owner->_loader->retrieveReferenceInfo(sectionInfo->module, currentRef, mskVMTRef, @@ -458,6 +470,37 @@ addr_t JITLinker::JITLinkerReferenceHelper :: resolveMDataVAddress() // --- JITLinker --- +JITLinker :: JITLinker(ReferenceMapperBase* mapper, + LibraryLoaderBase* loader, ForwardResolverBase* forwardResolver, + ImageProviderBase* provider, + JITLinkerSettings* settings, + AddressMapperBase* addressMapper +) : _staticMethods(INVALID_ADDR) +{ + _mapper = mapper; + _loader = loader; + _forwardResolver = forwardResolver; + _imageProvider = provider; + _compiler = nullptr; + _addressMapper = addressMapper; + + _alignment = settings->alignment; + _virtualMode = settings->virtualMode; + _classSymbolAutoLoadMode = settings->autoLoadMode; + _withDebugInfo = false; + _withOutputList = false; + + _constantSettings.intLiteralClass = forwardResolver->resolveForward(INTLITERAL_FORWARD); + _constantSettings.longLiteralClass = forwardResolver->resolveForward(LONGLITERAL_FORWARD); + _constantSettings.realLiteralClass = forwardResolver->resolveForward(REALLITERAL_FORWARD); + _constantSettings.literalClass = forwardResolver->resolveForward(LITERAL_FORWARD); + _constantSettings.wideLiteralClass = forwardResolver->resolveForward(WIDELITERAL_FORWARD); + _constantSettings.characterClass = forwardResolver->resolveForward(CHAR_FORWARD); + _constantSettings.messageClass = forwardResolver->resolveForward(MESSAGE_FORWARD); + _constantSettings.extMessageClass = forwardResolver->resolveForward(EXT_MESSAGE_FORWARD); + _constantSettings.messageNameClass = forwardResolver->resolveForward(MESSAGE_NAME_FORWARD); +} + addr_t JITLinker :: getVMTAddress(ModuleBase* module, ref_t reference, VAddressMap& references) { if (reference) { @@ -560,6 +603,16 @@ void JITLinker :: fixReferences(VAddressMap& relocations, MemoryBase* image) info.addressMask = 0; // clear because it is already fixed break; } + case mskHMTMethodOffset: + { + resolve(_loader->retrieveReferenceInfo(info.module, currentRef, mskVMTRef, + _forwardResolver), mskVMTRef, false); + pos_t offset = resolveHiddenMTMethodOffset(info.module, currentRef, info.message); + fixOffset(it.key(), info.addressMask, offset, image); + + info.addressMask = 0; // clear because it is already fixed + break; + } case mskMssgNameLiteralRef: { ref_t dummy = 0; @@ -649,6 +702,17 @@ pos_t JITLinker :: resolveVMTMethodOffset(ModuleBase* module, ref_t reference, m return offset; } +pos_t JITLinker :: resolveHiddenMTMethodOffset(ModuleBase* module, ref_t reference, mssg_t message) +{ + addr_t vmtAddress = resolve(_loader->retrieveReferenceInfo(module, reference, mskVMTRef, _forwardResolver), mskVMTRef, false); + + void* vmtPtr = getVMTPtr(vmtAddress); + + pos_t offset = _compiler->findHiddenMethodOffset(vmtPtr, message); + + return offset; +} + addr_t JITLinker :: loadMethod(ReferenceHelperBase& refHelper, MemoryReader& reader, MemoryWriter& writer) { pos_t position = writer.position(); @@ -806,6 +870,70 @@ void JITLinker :: resolveStaticFields(ReferenceInfo& referenceInfo, MemoryReader } } +void JITLinker :: fillMethodTable(addr_t vaddress, pos_t position, MemoryReader& vmtReader, ClassSectionInfo& sectionInfo, + MemoryBase* vmtImage, MemoryBase* codeImage, pos_t& size, pos_t& count, pos_t& indexCount, + VAddressMap& references, CachedOutputTypeList& outputTypeList, bool withOutputList) +{ + JITLinkerReferenceHelper helper(this, sectionInfo.module, &references); + + MemoryWriter codeWriter(codeImage); + MemoryReader codeReader(sectionInfo.codeSection); + + // fill the public method table + addr_t methodPosition = 0; + MethodEntry entry = { }; + + size -= sizeof(ClassHeader); + while (size > 0) { + vmtReader.read((void*)&entry, sizeof(MethodEntry)); + + if (entry.codeOffset == INVALID_POS) { + methodPosition = 0; + } + else { + codeReader.seek(entry.codeOffset); + methodPosition = loadMethod(helper, codeReader, codeWriter); + } + + // NOTE : statically linked message is not added to VMT + mssg_t message = helper.importMessage(entry.message); + if (test(entry.message, STATIC_MESSAGE)) { + _staticMethods.add( + { vaddress, message }, methodPosition); + } + else { + _compiler->addVMTEntry(message, methodPosition, + vmtImage->get(position), count); + + if (withOutputList && entry.outputRef && entry.outputRef != sectionInfo.reference) { + // NOTE : the list must contain already resolved message constants, so only type references must be resolved + outputTypeList.add({ message, entry.outputRef }); + } + } + + if (_addressMapper && methodPosition) + _addressMapper->addMethod(vaddress, message, methodPosition); + + size -= sizeof(MethodEntry); + } + + // fill the hidden (index) table + mssg_t indexMessage = vmtReader.getDWord(); + while (indexMessage) { + // add a new index + indexMessage = helper.importMessage(indexMessage); + + if (test(indexMessage, STATIC_MESSAGE)) { + _compiler->addIndexEntry(indexMessage, _staticMethods.get({ vaddress, indexMessage }), vmtImage->get(position), count, indexCount); + } + else { + _compiler->addIndexEntry(indexMessage, INVALID_ADDR, vmtImage->get(position), count, indexCount); + } + + indexMessage = vmtReader.getDWord(); + } +} + addr_t JITLinker :: createVMTSection(ReferenceInfo referenceInfo, ClassSectionInfo sectionInfo, VAddressMap& references) { @@ -820,8 +948,6 @@ addr_t JITLinker :: createVMTSection(ReferenceInfo referenceInfo, ClassSectionIn referenceInfo.module = sectionInfo.module; referenceInfo.referenceName = referenceInfo.module->resolveReference(sectionInfo.reference); - JITLinkerReferenceHelper helper(this, sectionInfo.module, &references); - // VMT just in time compilation MemoryReader vmtReader(sectionInfo.vmtSection); // read vmt record size @@ -839,7 +965,7 @@ addr_t JITLinker :: createVMTSection(ReferenceInfo referenceInfo, ClassSectionIn bool withOutputList = _withOutputList && !test(header.flags, elNestedClass); // allocate space and make VTM offset - _compiler->allocateVMT(vmtWriter, header.flags, header.count, + _compiler->allocateVMT(vmtWriter, header.flags, header.count, header.indexCount, header.staticSize, withOutputList); addr_t vaddress = calculateVAddress(vmtWriter, mskRDataRef); @@ -851,59 +977,23 @@ addr_t JITLinker :: createVMTSection(ReferenceInfo referenceInfo, ClassSectionIn // load the parent class addr_t parentAddress = getVMTAddress(sectionInfo.module, header.parentRef, references); - pos_t count = _compiler->copyParentVMT(getVMTPtr(parentAddress), vmtImage->get(position)); + auto counters = _compiler->copyParentVMT(getVMTPtr(parentAddress), vmtImage->get(position), header.count); + pos_t count = counters.value1; + pos_t indexCount = counters.value2; pos_t debugPosition = INVALID_POS; if (_withDebugInfo) debugPosition = createNativeClassDebugInfo(referenceInfo, vaddress); // read and compile VMT entries - MemoryWriter codeWriter(codeImage); - MemoryReader codeReader(sectionInfo.codeSection); - - addr_t methodPosition = 0; - MethodEntry entry = { }; - CachedOutputTypeList outputTypeList({}); - - size -= sizeof(ClassHeader); - while (size > 0) { - vmtReader.read((void*)&entry, sizeof(MethodEntry)); - - if (entry.codeOffset == INVALID_POS) { - methodPosition = 0; - } - else { - codeReader.seek(entry.codeOffset); - methodPosition = loadMethod(helper, codeReader, codeWriter); - } - - // NOTE : statically linked message is not added to VMT - mssg_t message = helper.importMessage(entry.message); - if (test(entry.message, STATIC_MESSAGE)) { - _staticMethods.add( - { vaddress, message }, methodPosition); - } - else { - _compiler->addVMTEntry(message, methodPosition, - vmtImage->get(position), count); - - if (withOutputList && entry.outputRef && entry.outputRef != sectionInfo.reference) { - // NOTE : the list must contain already resolved message constants, so only type references must be resolved - outputTypeList.add({ message, entry.outputRef }); - } - } - - if (_addressMapper && methodPosition) - _addressMapper->addMethod(vaddress, message, methodPosition); - - size -= sizeof(MethodEntry); - } + fillMethodTable(vaddress, position, vmtReader, sectionInfo, vmtImage, codeImage, size, + count, indexCount, references, outputTypeList, withOutputList); if (_withDebugInfo) endNativeDebugInfo(debugPosition); - if (count != header.count) + if (count != header.count || header.indexCount != indexCount) throw InternalError(errCorruptedVMT); // load the class class @@ -919,7 +1009,7 @@ addr_t JITLinker :: createVMTSection(ReferenceInfo referenceInfo, ClassSectionIn resolveOutputTypeList(referenceInfo, outputTypeList) : 0; // update VMT - JITCompilerBase::VMTFixInfo fixInfo = { parentAddress, classClassAddress, outputListAddress, header.flags, header.count }; + JITCompilerBase::VMTFixInfo fixInfo = { parentAddress, classClassAddress, outputListAddress, header.flags, header.count, header.indexCount }; _compiler->updateVMTHeader(vmtWriter, fixInfo, staticValues, _virtualMode); } diff --git a/elenasrc3/engine/jitlinker.h b/elenasrc3/engine/jitlinker.h index 7db73adcb8..b563920303 100644 --- a/elenasrc3/engine/jitlinker.h +++ b/elenasrc3/engine/jitlinker.h @@ -186,9 +186,14 @@ namespace elena_lang addr_t resolveVMTMethodAddress(ModuleBase* module, ref_t reference, mssg_t message); pos_t resolveVMTMethodOffset(ModuleBase* module, ref_t reference, mssg_t message); + pos_t resolveHiddenMTMethodOffset(ModuleBase* module, ref_t reference, mssg_t message); addr_t loadMethod(ReferenceHelperBase& refHelper, MemoryReader& reader, MemoryWriter& writer); + void fillMethodTable(addr_t vaddress, pos_t position, MemoryReader& vmtReader, ClassSectionInfo& sectionInfo, + MemoryBase* vmtImage, MemoryBase* codeImage, pos_t& size, pos_t& count, pos_t& indexCount, + VAddressMap& references, CachedOutputTypeList& outputTypeList, bool withOutputList); + addr_t createVMTSection(ReferenceInfo referenceInfo, ClassSectionInfo sectionInfo, VAddressMap& references); @@ -265,36 +270,12 @@ namespace elena_lang void copyPreloadedMetaList(ModuleInfo info, ModuleInfoList& output, bool ignoreAutoLoadExtensions); - JITLinker(ReferenceMapperBase* mapper, + JITLinker(ReferenceMapperBase* mapper, LibraryLoaderBase* loader, ForwardResolverBase* forwardResolver, ImageProviderBase* provider, JITLinkerSettings* settings, AddressMapperBase* addressMapper - ) : _staticMethods(INVALID_ADDR) - { - _mapper = mapper; - _loader = loader; - _forwardResolver = forwardResolver; - _imageProvider = provider; - _compiler = nullptr; - _addressMapper = addressMapper; - - _alignment = settings->alignment; - _virtualMode = settings->virtualMode; - _classSymbolAutoLoadMode = settings->autoLoadMode; - _withDebugInfo = false; - _withOutputList = false; - - _constantSettings.intLiteralClass = forwardResolver->resolveForward(INTLITERAL_FORWARD); - _constantSettings.longLiteralClass = forwardResolver->resolveForward(LONGLITERAL_FORWARD); - _constantSettings.realLiteralClass = forwardResolver->resolveForward(REALLITERAL_FORWARD); - _constantSettings.literalClass = forwardResolver->resolveForward(LITERAL_FORWARD); - _constantSettings.wideLiteralClass = forwardResolver->resolveForward(WIDELITERAL_FORWARD); - _constantSettings.characterClass = forwardResolver->resolveForward(CHAR_FORWARD); - _constantSettings.messageClass = forwardResolver->resolveForward(MESSAGE_FORWARD); - _constantSettings.extMessageClass = forwardResolver->resolveForward(EXT_MESSAGE_FORWARD); - _constantSettings.messageNameClass = forwardResolver->resolveForward(MESSAGE_NAME_FORWARD); - } + ); }; } diff --git a/elenasrc3/engine/langcommon.h b/elenasrc3/engine/langcommon.h index 9f783a1437..506c94f84f 100644 --- a/elenasrc3/engine/langcommon.h +++ b/elenasrc3/engine/langcommon.h @@ -29,8 +29,9 @@ namespace elena_lang None = 0x00000000, Normal = 0x00000001, Sealed = 0x00000003, - Virtual = 0x00000005, + Fixed = 0x00000005, Dispatcher = 0x00000007, + ByIndex = 0x00000008, Async = 0x00000010, Interpolator = 0x00000020, @@ -38,27 +39,31 @@ namespace elena_lang Function = 0x00000080, Generic = 0x00000100, RetOverload = 0x00000200, + Constructor = 0x00000400, + Conversion = 0x00000800, Multimethod = 0x00001000, TargetSelf = 0x00002000, Static = 0x00004000, GetAccessor = 0x00008000, Mixin = 0x00010000, Abstract = 0x00020000, - Internal = 0x00040000, - Predefined = 0x00080000, // virtual class declaration - Stacksafe = 0x00100000, - Constructor = 0x00200400, - Conversion = 0x00200800, - SetAccessor = 0x00400000, - InterfaceDispatcher = 0x00800000, + Predefined = 0x00040000, // virtual class declaration + Stacksafe = 0x00080000, + SetAccessor = 0x00100000, + Indexed = 0x00200000, + InterfaceDispatcher = 0x00400000, + Constant = 0x00800000, VirtualReturn = 0x01000000, // used for MutliRet with non-embeddable return type - Constant = 0x02000000, - Protected = 0x04000000, - Private = 0x08000000, - Extension = 0x10000000, - Initializer = 0x20000000, - Autogenerated = 0x40000000, - Yieldable = 0x80000000, + Extension = 0x02000000, + Initializer = 0x04000000, + Autogenerated = 0x08000000, + Yieldable = 0x10000000, + + Protected = 0x40000000, + Internal = 0x80000000, + Private = 0xC0000000, + + VisibilityMask = 0xC0000000, }; // --- MethodInfo --- @@ -89,6 +94,27 @@ namespace elena_lang nillableArgs(nillableArgs) { } + + static bool checkHint(MethodInfo& info, MethodHint hint) + { + return test(info.hints, (ref_t)hint); + } + + static bool checkVisibility(MethodInfo& info, MethodHint hint) + { + return (info.hints & (ref_t)MethodHint::VisibilityMask) == (ref_t)hint; + } + + static bool checkVisibility(MethodInfo& info, MethodHint hint1, MethodHint hint2) + { + ref_t mask = info.hints & (ref_t)MethodHint::VisibilityMask; + + return mask == (ref_t)hint1 || mask == (ref_t)hint2; + } + static bool checkType(MethodInfo& info, MethodHint type) + { + return (info.hints & (ref_t)MethodHint::Mask) == (ref_t)type; + } }; // --- SymbolInfo --- @@ -424,8 +450,11 @@ namespace elena_lang constexpr auto V_CATEGORY_MAX = 0x0000F000u; /// modificator - constexpr auto V_IGNOREDUPLICATE = 0x80006001u; - constexpr auto V_SCRIPTSELFMODE = 0x80006002u; + constexpr auto V_IGNOREDUPLICATE = 0x80007001u; + constexpr auto V_SCRIPTSELFMODE = 0x80007002u; + + /// indexed + constexpr auto V_INDEXED_ATTR = 0x80006001u; /// accessors: constexpr auto V_GETACCESSOR = 0x80005001u; @@ -637,6 +666,59 @@ namespace elena_lang constexpr pos_t VM_SEND_MESSAGE_CMD = 0x112; constexpr pos_t VM_TRYCALLSYMBOL_CMD = 0x113; + // --- ELENA standard forwards + constexpr auto INLINE_CLASSNAME = "$inline"; // nested class generic name + + constexpr auto OPERATION_MAP_KEY = "statements"; + constexpr auto PREDEFINED_MAP_KEY = "defaults"; + constexpr auto ATTRIBUTES_MAP_KEY = "attributes"; + constexpr auto ALIASES_MAP_KEY = "aliases"; + + constexpr auto OPERATION_MAP = "system@operations@statements"; + constexpr auto PREDEFINED_MAP = "system@predefined@defaults"; + constexpr auto ATTRIBUTES_MAP = "system@attributes@attributes"; + constexpr auto ALIASES_MAP = "system@predefined@aliases"; + + constexpr auto STARTUP_ENTRY = "$auto'startUpSymbol"; + + constexpr auto VM_TAPE = "$elena'meta$startUpTape"; + + constexpr auto PROGRAM_ENTRY = "$forwards'program"; // used by the linker to define the debug entry + + constexpr auto SYSTEM_FORWARD = "$system_entry"; // the system entry + constexpr auto SUPER_FORWARD = "$super"; // the common class predecessor + constexpr auto NILVALUE_FORWARD = "$nil"; // the nil value + constexpr auto INTLITERAL_FORWARD = "$int"; // the int literal + constexpr auto LONGLITERAL_FORWARD = "$long"; // the long literal + constexpr auto REALLITERAL_FORWARD = "$real"; // the real literal + constexpr auto INT8LITERAL_FORWARD = "$int8"; // the int literal + constexpr auto UINT8LITERAL_FORWARD = "$uint8"; // the int literal + constexpr auto INT16LITERAL_FORWARD = "$short"; // the int literal + constexpr auto UINT16LITERAL_FORWARD = "$ushort"; // the int literal + constexpr auto LITERAL_FORWARD = "$string"; // the string literal + constexpr auto WIDELITERAL_FORWARD = "$wide"; // the wide string literal + constexpr auto CHAR_FORWARD = "$char"; // the char literal + constexpr auto BOOL_FORWARD = "$boolean"; // the boolean class + constexpr auto TRUE_FORWARD = "$true"; // the true boolean value + constexpr auto FALSE_FORWARD = "$false"; // the false boolean value + constexpr auto WRAPPER_FORWARD = "$ref"; // the wrapper template + constexpr auto ARRAY_FORWARD = "$array"; // the array template + constexpr auto VARIADIC_ARRAY_FORWARD = "$varray"; // the array template + constexpr auto MESSAGE_FORWARD = "$message"; // the message class + constexpr auto MESSAGE_NAME_FORWARD = "$subject"; // the message class + constexpr auto EXT_MESSAGE_FORWARD = "$ext_message"; // the extension message class + constexpr auto CLOSURE_FORWARD = "$closure"; // the closure template class + constexpr auto TUPLE_FORWARD = "$tuple"; // the tuple template class + constexpr auto YIELDIT_FORWARD = "$yieldit"; // the yield state machine iterator template class + constexpr auto ASYNCIT_FORWARD = "$taskit"; // the async state machine iterator template class + constexpr auto UINT_FORWARD = "$uint"; // the uint wrapper + constexpr auto PTR_FORWARD = "$ptr"; // the ptr wrapper + constexpr auto TASK_FORWARD = "$task"; // the ptr wrapper + constexpr auto LAZY_FORWARD = "$lazy"; + constexpr auto NULLABLE_FORWARD = "$nullable"; + constexpr auto PRELOADED_FORWARD = "system@preloadedSymbols"; + constexpr auto START_FORWARD = "$symbol_entry"; + // --- Configuration xpaths --- constexpr auto WIN_X86_KEY = "Win_x86"; constexpr auto WIN_X86_64_KEY = "Win_x64"; diff --git a/elenasrc3/ide/idecontroller.cpp b/elenasrc3/ide/idecontroller.cpp index dadcd7a838..4c2b0fe9ac 100644 --- a/elenasrc3/ide/idecontroller.cpp +++ b/elenasrc3/ide/idecontroller.cpp @@ -244,7 +244,7 @@ void ProjectController :: defineSourceName(ProjectModel* model, path_t path, Nam bool ProjectController :: startDebugger(ProjectModel& model, DebugActionResult& result) { ustr_t target = model.getTarget(); - ustr_t arguments = model.getArguments(); + path_t arguments = model.getArguments(); if (!target.empty()) { PathString exePath(*model.projectPath, target); diff --git a/elenasrc3/ide/ideproject.cpp b/elenasrc3/ide/ideproject.cpp index efba7c145a..4becd2ca5f 100644 --- a/elenasrc3/ide/ideproject.cpp +++ b/elenasrc3/ide/ideproject.cpp @@ -46,9 +46,9 @@ ustr_t ProjectModel::getPackage() return *package; } -ustr_t ProjectModel :: getArguments() +path_t ProjectModel :: getArguments() { - return nullptr; // !! temporal + return *debugArguments; } bool ProjectModel :: getDebugMode() diff --git a/elenasrc3/ide/ideproject.h b/elenasrc3/ide/ideproject.h index 66dfd266d8..aa167eaa69 100644 --- a/elenasrc3/ide/ideproject.h +++ b/elenasrc3/ide/ideproject.h @@ -87,7 +87,7 @@ namespace elena_lang StringList profileList; ustr_t getTarget(); - ustr_t getArguments(); + path_t getArguments(); ustr_t getPackage(); diff --git a/elenasrc3/ide/ideversion.h b/elenasrc3/ide/ideversion.h index 9af9fcf75d..d1c877194f 100644 --- a/elenasrc3/ide/ideversion.h +++ b/elenasrc3/ide/ideversion.h @@ -1,2 +1,2 @@ -#define IDE_REVISION_NUMBER 16 +#define IDE_REVISION_NUMBER 18 diff --git a/elenasrc3/tools/asmc/x86assembler.cpp b/elenasrc3/tools/asmc/x86assembler.cpp index 4216a94d45..9030ed2e91 100644 --- a/elenasrc3/tools/asmc/x86assembler.cpp +++ b/elenasrc3/tools/asmc/x86assembler.cpp @@ -1486,6 +1486,10 @@ bool X86Assembler :: compileAdd(X86Operand source, X86Operand target, MemoryWrit writer.writeByte(0x01); X86Helper::writeModRM(writer, target, source); } + else if (source.isR32() && target.isR32_M32()) { + writer.writeByte(0x03); + X86Helper::writeModRM(writer, source, target); + } else if (source.isR8_M8() && target.isR8()) { writer.writeByte(0x00); X86Helper::writeModRM(writer, target, source); @@ -3161,6 +3165,11 @@ bool X86_64Assembler::compileAdd(X86Operand source, X86Operand target, MemoryWri writer.writeByte(0x01); X86Helper::writeModRM(writer, target, source); } + else if (source.isR64() && target.isR64_M64()) { + writer.writeByte(0x48); + writer.writeByte(0x03); + X86Helper::writeModRM(writer, source, target); + } else return X86Assembler::compileAdd(source, target, writer); return true; diff --git a/elenasrc3/tools/ldoc/ldoc.cpp b/elenasrc3/tools/ldoc/ldoc.cpp index 15f797430f..aecfb06b7b 100644 --- a/elenasrc3/tools/ldoc/ldoc.cpp +++ b/elenasrc3/tools/ldoc/ldoc.cpp @@ -1109,6 +1109,9 @@ void DocGenerator :: loadType(ref_t reference, IdentifierString& target, bool te void DocGenerator :: loadType(ustr_t name, IdentifierString& target, bool templateMode) { if (isTemplateWeakReference(name)) { + if (name.findStr("Rang") != NOTFOUND_POS) + templateMode = true; + IdentifierString type(name); IdentifierString ns; @@ -1282,7 +1285,7 @@ void DocGenerator :: loadClassMethod(ApiClassInfo* apiClassInfo, mssg_t message, apiMethodInfo->cast = true; } - if (test(methodInfo.hints, (ref_t)MethodHint::Internal)) { + if (MethodInfo::checkVisibility(methodInfo, MethodHint::Internal)) { size_t index = (*apiMethodInfo->name).findStr("$$"); if (index != NOTFOUND_POS) apiMethodInfo->name.cut(0, index + 2); @@ -1306,7 +1309,7 @@ void DocGenerator :: loadClassMethod(ApiClassInfo* apiClassInfo, mssg_t message, } if (!test(methodInfo.hints, (ref_t)MethodHint::Autogenerated) - && (!_publicOnly || !test(methodInfo.hints, (ref_t)MethodHint::Private))) + && (!_publicOnly || !MethodInfo::checkVisibility(methodInfo, MethodHint::Private))) { bool first = true; for (auto attr_it = classInfo.attributes.start(); !attr_it.eof(); ++attr_it) { @@ -1473,6 +1476,19 @@ bool isTemplateDeclaration(ustr_t referenceName) return referenceName.findStr("@T1") != NOTFOUND_POS/* && referenceName.findStr("$private") != NOTFOUND_POS*/; } +bool isOwnTemplate(ustr_t referenceName, ustr_t ns) +{ + ReferenceProperName templateName(referenceName); + + size_t index = (*templateName).find('#'); + templateName.cut(index, templateName.length() - index); + index = (*templateName).findLast('@'); + templateName.cut(index, templateName.length() - index); + templateName.replaceAll('@', '\'', 0); + + return ns.compare(*templateName); +} + void DocGenerator :: loadMember(ApiModuleInfoList& modules, ref_t reference) { auto referenceName = _module->resolveReference(reference); @@ -1549,7 +1565,7 @@ void DocGenerator :: loadMember(ApiModuleInfoList& modules, ref_t reference) if (_module->mapSection(reference | mskVMTRef, true) || extensionRef) { bool templateBased = false; if (isTemplateBased(referenceName)) { - if (isTemplateDeclaration(referenceName)) { + if (isTemplateDeclaration(referenceName) && isOwnTemplate(referenceName, _module->name())) { templateBased = true; parseTemplateName(properName, templateBased); diff --git a/elenasrc3/tools/ldoc/ldocconst.h b/elenasrc3/tools/ldoc/ldocconst.h index 957aa5da1f..de26e8fc86 100644 --- a/elenasrc3/tools/ldoc/ldocconst.h +++ b/elenasrc3/tools/ldoc/ldocconst.h @@ -11,7 +11,7 @@ namespace elena_lang { - #define LDOC_REVISION_NUMBER 0x001A + #define LDOC_REVISION_NUMBER 0x001C constexpr auto LDOC_GREETING = "ELENA command line Html Documentation generator %d.%d.%d (C)2021-24 by Aleksey Rakov\n"; constexpr auto LDOC_READING = "Reading...\n"; @@ -19,7 +19,7 @@ namespace elena_lang constexpr auto LDOC_MODULE_NOTLOADED = "cannot load a module: %s"; - constexpr auto TITLE = "ELENA Standard Library 6.3: Module "; + constexpr auto TITLE = "ELENA Standard Library 6.4: Module "; constexpr auto TITLE2 = "ELENA Standard Library
    6.3"; } diff --git a/examples60/console/binary/binary.l b/examples60/console/binary/binary.l index a09ca64be0..eacc614eb5 100644 --- a/examples60/console/binary/binary.l +++ b/examples60/console/binary/binary.l @@ -5,16 +5,16 @@ import extensions; public program() { // reading - var number := console.write("Enter the number you want to convert: ").loadLineTo(Integer.new()); + var number := Console.write("Enter the number you want to convert: ").loadLineTo(Integer.new()); // converting var binaryStr := number.toString(2); // printing - console + Console .printLine("A binary presentation of the number : ",binaryStr.padLeft($48, (binaryStr.Length / 4 + 1) * 4)) .printLine("Press any key to continue"); // waiting for any key - console.readChar() + Console.readChar() } diff --git a/examples60/console/bsort/bsort.l b/examples60/console/bsort/bsort.l index 46c06e2cf8..ceacf963b6 100644 --- a/examples60/console/bsort/bsort.l +++ b/examples60/console/bsort/bsort.l @@ -6,7 +6,7 @@ import extensions; prompter(int index) { - ^ console.print("Enter array[",index,"]:").loadLineTo(Integer.new()).Value + ^ Console.print("Enter array[",index,"]:").loadLineTo(Integer.new()).Value } // --- bsortOp --- @@ -65,7 +65,7 @@ extension bsortOp public program() { // 1. Create the array - var size := console.write("Enter the array size:").loadLineTo(Integer.new()).Value; + var size := Console.write("Enter the array size:").loadLineTo(Integer.new()).Value; // 2. Initialize the array var array := Array.allocate(size).populate(prompter); @@ -74,7 +74,7 @@ public program() array.bsort(); // 4. Print the array - console.printLine("Sorted array:",array); + Console.printLine("Sorted array:",array); - console.readChar() // wait for any key + Console.readChar() // wait for any key } \ No newline at end of file diff --git a/examples60/console/build.bat b/examples60/console/build.bat index 191e71c16e..9319b95d48 100644 --- a/examples60/console/build.bat +++ b/examples60/console/build.bat @@ -3,12 +3,12 @@ if %ERRORLEVEL% EQU -2 GOTO CompilerError @echo on -..\..\bin\elena-cli sum\intsum.prj +..\..\bin\elena-cli -lintsum sum\sum.prj @echo off if %ERRORLEVEL% EQU -2 GOTO CompilerError @echo on -..\..\bin\elena-cli sum\realsum.prj +..\..\bin\elena-cli -lrealsum sum\sum.prj @echo off if %ERRORLEVEL% EQU -2 GOTO CompilerError @echo on diff --git a/examples60/console/collatz/collatz.l b/examples60/console/collatz/collatz.l index b0e6fff86e..ebd9f4e916 100644 --- a/examples60/console/collatz/collatz.l +++ b/examples60/console/collatz/collatz.l @@ -23,41 +23,41 @@ altcol(x) //% Simple branching //disp('Execute branches independently w. half morphism') - console.printLine("Execute branches independently w. half morphism"); + Console.printLine("Execute branches independently w. half morphism"); //y = f( hR(x, 1-Id(x), 0) ); var y := f(hR(x,1-Id(x),0)); //disp(['1st branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("1st branch: mod: ",Id(x)," out: ",y); + Console.printLine("1st branch: mod: ",Id(x)," out: ",y); //y = g( hR(x, Id(x), -1/3) ); y := g(hR(x, Id(x), -1.realDiv(3))); //disp(['2nd branch: mod: ',num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("2st branch: mod: ",Id(x)," out: ",y); + Console.printLine("2st branch: mod: ",Id(x)," out: ",y); //disp ' ' //% Branching w. safety value return (restore original) //disp('Execute branches independently w. full morphism') - console.printLine("Execute branches independently w. full morphism"); + Console.printLine("Execute branches independently w. full morphism"); //y = hL( x, 1-Id(x), 0, f( hR(x, 1-Id(x), 0) ) ); y := hL(x, 1-Id(x), 0, f(hR(x, 1-Id(x), 0))); //disp(['1st branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("1st branch: mod: ",Id(x)," out: ",y); + Console.printLine("1st branch: mod: ",Id(x)," out: ",y); //y = hL( x, Id(x), 0, g( hR(x, Id(x), -1/3) ) ); y := hL(x, Id(x), 0, g(hR(x, Id(x), -1.realDiv(3)))); //disp(['2nd branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("2st branch: mod: ", Id(x), " out: ", y); + Console.printLine("2st branch: mod: ", Id(x), " out: ", y); //disp ' ' //% All together //disp('Execute combined morphism') - console.printLine("Execute combined morphism"); + Console.printLine("Execute combined morphism"); //y = hL( x, 1-Id(x), 0, f( hR(x, 1-Id(x), 0) ) ); y := hL(x, 1 - Id(x), 0, f(hR(x, 1- Id(x), 0))); @@ -66,7 +66,7 @@ altcol(x) var z := hL(y, Id(x), 0, g(hR(y, Id(x), -1.realDiv(3)))).toInt(); //disp(['Final out: ', num2str(z), ' Correct should be ', num2str( col(x) )]) - console.printLine("Final out: ",z," Correct should be ", col(x)); + Console.printLine("Final out: ",z," Correct should be ", col(x)); //end } @@ -101,41 +101,41 @@ altcolsingle(x) //% Simple branching //disp('Execute branches independently w. half morphism') - console.printLine("Execute branches independently w. half morphism"); + Console.printLine("Execute branches independently w. half morphism"); //y = f( h(x, 1-Id(x), 0, 0) ); var y := f(h(x, 1 - Id(x), 0, 0)); //disp(['1st branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("1st branch: mod: ",Id(x)," out: ",y); + Console.printLine("1st branch: mod: ",Id(x)," out: ",y); //y = g( h(x, Id(x), -1/3, -1/3) ); y := g(h(x,Id(x),-1.realDiv(3), -1.realDiv(3))); //disp(['2nd branch: mod: ',num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("2st branch: mod: ",Id(x)," out: ",y); + Console.printLine("2st branch: mod: ",Id(x)," out: ",y); //disp ' ' //% Branching w. safety value return (restore original) //disp('Execute branches independently w. full morphism') - console.printLine("Execute branches independently w. full morphism"); + Console.printLine("Execute branches independently w. full morphism"); //y = h( x, Id(x), 0, f( h(x, 1-Id(x), 0, 0) ) ); y := h(x, Id(x), 0, f(h(x, 1 - Id(x), 0, 0))).toInt(); //disp(['1st branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("1st branch: mod: ", Id(x), " out: ", y); + Console.printLine("1st branch: mod: ", Id(x), " out: ", y); //y = h( x, 1-Id(x), 0, g( h(x, Id(x), -1/3, -1/3) ) ); y := h(x, 1 - Id(x),0, g(h(x, Id(x),-1.realDiv(3), -1.realDiv(3)))).toInt(); //disp(['2nd branch: mod: ', num2str(Id(x)),' out: ', num2str(y)]) - console.printLine("2st branch: mod: ", Id(x)," out: ", y); + Console.printLine("2st branch: mod: ", Id(x)," out: ", y); //disp ' ' //% All together //disp('Execute combined morphism') - console.printLine("Execute combined morphism"); + Console.printLine("Execute combined morphism"); //y = h( x, Id(x), 0, f( h(x, 1-Id(x), 0, 0) ) ); y := h(x, Id(x), 0, f(h(x, 1 - Id(x),0,0))); @@ -144,7 +144,7 @@ altcolsingle(x) var z := h(y, 1 - Id(x),0, g(h(y, Id(x),-1.realDiv(3), -1.realDiv(3)))).toInt(); //disp(['Final out: ', num2str(z), ' Correct should be ', num2str( col(x) )]) - console.printLine("Final out: ",z," Correct should be ",col(x)); + Console.printLine("Final out: ",z," Correct should be ",col(x)); } //end diff --git a/examples60/console/datetime/control.l b/examples60/console/datetime/control.l index be3aef90d5..de56cf0696 100644 --- a/examples60/console/datetime/control.l +++ b/examples60/console/datetime/control.l @@ -3,7 +3,7 @@ import extensions; // --- Control --- -public singleton control +public singleton Control { get string Prompt = "Please select your option: @@ -19,11 +19,11 @@ public singleton control auto choice := s.toInt(); choice => - 1 { ^now.toString() } - 2 { ^utcNow.toString() } - 3 { ^now.Year.toString() } - 4 { ^now.toShortTimeString() } - 7 { forward program.stop(); ^ emptyString } + 1 { ^Now.toString() } + 2 { ^UtcNow.toString() } + 3 { ^Now.Year.toString() } + 4 { ^Now.toShortTimeString() } + 7 { forward program.stop(); ^ EmptyString } ! { ^"Invalid choice" } } } \ No newline at end of file diff --git a/examples60/console/datetime/datetime.prj b/examples60/console/datetime/datetime.prj index 49d18655af..086dc4b154 100644 --- a/examples60/console/datetime/datetime.prj +++ b/examples60/console/datetime/datetime.prj @@ -19,7 +19,7 @@ - extensions'programLoop - datetime'control + extensions'ProgramLoop + datetime'Control \ No newline at end of file diff --git a/examples60/console/goods/goods.l b/examples60/console/goods/goods.l index f70f68c32c..fd223f8809 100644 --- a/examples60/console/goods/goods.l +++ b/examples60/console/goods/goods.l @@ -67,13 +67,13 @@ class Adapter public program() { - if(program_arguments.Length == 1) - { console.printLine("Please provide the path to the file to view"); AbortException.raise() }; + if(Program_arguments.Length == 1) + { Console.printLine("Please provide the path to the file to view"); AbortException.raise() }; var list := new List(); var adapter := new Adapter(); - File.assign(program_arguments[1]).forEachLine::(line) + File.assign(Program_arguments[1]).forEachLine::(line) { adapter.write(line); @@ -90,5 +90,5 @@ public program() list.forEach(printingLn); - console.readChar() + Console.readChar() } diff --git a/examples60/console/helloworld/helloworld.l b/examples60/console/helloworld/helloworld.l index faee477b6b..623216df44 100644 --- a/examples60/console/helloworld/helloworld.l +++ b/examples60/console/helloworld/helloworld.l @@ -2,8 +2,8 @@ public program() { - console.writeLine("Hello World"); + Console.writeLine("Hello World"); // wait for any key - console.readChar() + Console.readChar() } diff --git a/examples60/console/matrix/matrix.l b/examples60/console/matrix/matrix.l index 06bf38cc93..a2207d6e64 100644 --- a/examples60/console/matrix/matrix.l +++ b/examples60/console/matrix/matrix.l @@ -19,7 +19,7 @@ class Matrix constructor create(int n, string name) <= new (RealMatrix.allocate(n,n).populate::(int i,int j) { - ^ console.print("Enter ",name,"[",i,",",j,"]=").readLine().toReal() + ^ Console.print("Enter ",name,"[",i,",",j,"]=").readLine().toReal() }); constructor newIdentityOf(int n) @@ -43,7 +43,7 @@ class Matrix // ---- Program --- -public singleton control +public singleton Control { Prompt = "Choose an option [1] - Sum Matrix @@ -58,66 +58,66 @@ Your choice:"; { choice => "1" { - console.write("Enter the order of matrix: "); - var N := console.readLine().toInt(); + Console.write("Enter the order of matrix: "); + var N := Console.readLine().toInt(); var matrixA := Matrix.create(N, "A"); - console.writeLine(); + Console.writeLine(); var matrixB := Matrix.create(N,"B"); - console.writeLine().writeLine("Output:"); + Console.writeLine().writeLine("Output:"); RealMatrix sum := matrixA + matrixB; ^ sum.toString() } "2" { - console.write("Enter the order of matrix: "); - var N := console.readLine().toInt(); + Console.write("Enter the order of matrix: "); + var N := Console.readLine().toInt(); var matrixA := Matrix.create(N, "A"); - console.writeLine(); + Console.writeLine(); var matrixB := Matrix.create(N,"B"); - console.writeLine().writeLine("Output:"); + Console.writeLine().writeLine("Output:"); RealMatrix diff := matrixA - matrixB; ^ diff.toString() } "3" { - console.write("Enter the order of matrix: "); - var N := console.readLine().toInt(); + Console.write("Enter the order of matrix: "); + var N := Console.readLine().toInt(); var matrixA := Matrix.create(N, "A"); - console.writeLine(); + Console.writeLine(); var matrixB := Matrix.create(N,"B"); - console.writeLine().writeLine("Output:"); + Console.writeLine().writeLine("Output:"); RealMatrix product := matrixA * matrixB; ^ product.toString() } "4" { - console.write("Enter the order of matrix: "); - var N := console.readLine().toInt(); + Console.write("Enter the order of matrix: "); + var N := Console.readLine().toInt(); var matrixA := Matrix.create(N, "A"); - console.writeLine().writeLine("Output:"); + Console.writeLine().writeLine("Output:"); ^ matrixA.Determinant } "5" { - console.write("Enter the order of matrix: "); - var N := console.readLine().toInt(); + Console.write("Enter the order of matrix: "); + var N := Console.readLine().toInt(); RealMatrix identity := Matrix.newIdentityOf(N); diff --git a/examples60/console/matrix/matrix.prj b/examples60/console/matrix/matrix.prj index 17fef952c1..af8e9f2376 100644 --- a/examples60/console/matrix/matrix.prj +++ b/examples60/console/matrix/matrix.prj @@ -20,7 +20,7 @@ - extensions'programLoop - matrix'control + extensions'ProgramLoop + matrix'Control \ No newline at end of file diff --git a/examples60/console/pi/pi.l b/examples60/console/pi/pi.l index 0934b3984d..3c3de41001 100644 --- a/examples60/console/pi/pi.l +++ b/examples60/console/pi/pi.l @@ -5,7 +5,7 @@ const int MAX = 50000000; public program() { - var started := now; + var started := Now; real pi := 0.0; for(int i := 0; i < MAX; i += 1) @@ -13,12 +13,12 @@ public program() pi += -1.0.power(i) / (i*2+1) * 4 }; - var ended := now; + var ended := Now; - console.printLine(pi); + Console.printLine(pi); var diff := ended - started; - console.printLine("Time elapsed in msec:",diff.Milliseconds); + Console.printLine("Time elapsed in msec:",diff.Milliseconds); - console.readChar() + Console.readChar() } diff --git a/examples60/console/pi2/pi2.l b/examples60/console/pi2/pi2.l index 183cab810f..8c6577be9e 100644 --- a/examples60/console/pi2/pi2.l +++ b/examples60/console/pi2/pi2.l @@ -7,10 +7,10 @@ const int ARRAY_SIZE = 32768; public program() { int casas := 50; - if(program_arguments.Length > 1) - { casas := program_arguments[1].toInt() }; + if(Program_arguments.Length > 1) + { casas := Program_arguments[1].toInt() }; - var start := now; + var start := Now; //#var x := system'Array new &length:ARRAY_SIZE. auto x := new int[](ARRAY_SIZE); @@ -383,12 +383,12 @@ public program() while (x[xc] != 0) { xc := xc + 2; - console.write(charConvertor.convert(x[xc])); + Console.write(charConvertor.convert(x[xc])); xc := xc -4; while (x[xc] != 0) { x[xc] := x[xc] + 1; - console.write(charConvertor.convert(x[xc])); + Console.write(charConvertor.convert(x[xc])); while (x[xc] != 0) { x[xc] := x[xc] - 1 @@ -401,7 +401,7 @@ public program() while (x[xc] != 0) { xc := xc + 2; - console.write(charConvertor.convert(x[xc])); + Console.write(charConvertor.convert(x[xc])); xc := xc -2; x[xc] := x[xc] - 1 }; @@ -443,14 +443,14 @@ public program() xc := xc -8 }; x[xc] := x[xc] + 10; - console.write(charConvertor.convert(x[xc])); + Console.write(charConvertor.convert(x[xc])); - var end := now; + var end := Now; - console.writeLine(); + Console.writeLine(); var diff := end - start; - console.printLine("Time elapsed in msec:",diff.Milliseconds); + Console.printLine("Time elapsed in msec:",diff.Milliseconds); - console.readChar() + Console.readChar() } diff --git a/examples60/console/random/random.l b/examples60/console/random/random.l index 78d1dc358a..be5ba95388 100644 --- a/examples60/console/random/random.l +++ b/examples60/console/random/random.l @@ -17,31 +17,31 @@ public program() var intCounts := new int[](distGroupCount); var realCounts := new int[](distGroupCount); - console.printLine("Random reals:"); + Console.printLine("Random reals:"); for(int i := 0; i < rows; i += 1) { for(int j := 0; j <= cols; j += 1) { - console.printPaddingRight(12, randomGenerator.nextReal()); + Console.printPaddingRight(12, randomGenerator.nextReal()); }; - console.writeLine() + Console.writeLine() }; - console.writeLine(); - console.writeLine("Random integers:"); + Console.writeLine(); + Console.writeLine("Random integers:"); for(int i := 0; i < rows; i += 1) { for(int j := 0; j <= cols; j += 1) { - console.printPaddingRight(12, randomGenerator.nextInt()); + Console.printPaddingRight(12, randomGenerator.nextInt()); }; - console.writeLine() + Console.writeLine() }; - console.writeLine(); - console.writeLine("Distribution"); + Console.writeLine(); + Console.writeLine("Distribution"); for(int i := 0; i < runCount; i += 1) { @@ -56,14 +56,14 @@ public program() for(int i := 0; i < distGroupCount; i += 1) { - console.printPaddingLeft(12, (i * intGroupSize).toInt(),"-"); - console.printPaddingLeft(12, ((i + 1) * intGroupSize - 1).toInt()); - console.printPaddingLeft(12, intCounts[i]); + Console.printPaddingLeft(12, (i * intGroupSize).toInt(),"-"); + Console.printPaddingLeft(12, ((i + 1) * intGroupSize - 1).toInt()); + Console.printPaddingLeft(12, intCounts[i]); - console.printPaddingLeft(14, i.toReal() / distGroupCount,"-"); - console.printPaddingLeft(12, (i + 1).toReal() / distGroupCount); - console.printPaddingLeft(12, realCounts[i]); + Console.printPaddingLeft(14, i.toReal() / distGroupCount,"-"); + Console.printPaddingLeft(12, (i + 1).toReal() / distGroupCount); + Console.printPaddingLeft(12, realCounts[i]); - console.writeLine() + Console.writeLine() } } diff --git a/examples60/console/replace/replace.l b/examples60/console/replace/replace.l index 996188d9d6..9210a5c1a1 100644 --- a/examples60/console/replace/replace.l +++ b/examples60/console/replace/replace.l @@ -5,9 +5,9 @@ import extensions'text; public program() { - var text := console.print("Enter the text:").loadLineTo(new StringWriter()); - var searchText := console.print("Enter the phrase to be found:").readLine(); - var replaceText := console.print("Enter the phrase to replace with:").readLine(); + var text := Console.print("Enter the text:").loadLineTo(new StringWriter()); + var searchText := Console.print("Enter the phrase to be found:").readLine(); + var replaceText := Console.print("Enter the phrase to replace with:").readLine(); var bm := new StringBookmark(text); @@ -16,7 +16,7 @@ public program() bm.delete(searchText).insert(replaceText) }; - console + Console .printLine("The resulting text:",bm) .readChar() // wait for any key } diff --git a/examples60/console/sum/sum.l b/examples60/console/sum/sum.l index a4677e7a7a..8ec69ce840 100644 --- a/examples60/console/sum/sum.l +++ b/examples60/console/sum/sum.l @@ -18,21 +18,21 @@ extension EReader } catch(Exception e) { - console.writeLine(e.Message).readChar(); + Console.writeLine(e.Message).readChar(); AbortException.raise() } } } -enteredNumber = forward number.new().loadFrom(console); +EnteredNumber = forward number.new().loadFrom(Console); // --- Program --- public program() { - console + Console .printLine(forward prompt) - .printLine("The sum is ",enteredNumber + enteredNumber) + .printLine("The sum is ",EnteredNumber + EnteredNumber) .readChar() } diff --git a/examples60/console/trans/control.l b/examples60/console/trans/control.l index a786b72301..1f367ef77b 100644 --- a/examples60/console/trans/control.l +++ b/examples60/console/trans/control.l @@ -5,11 +5,11 @@ public program() { while(true) { - var source := console.writeLine("Enter the cyrillic text for transliteration or prese enter to exit:").loadLineTo(new StringWriter()); + var source := Console.writeLine("Enter the cyrillic text for transliteration or prese enter to exit:").loadLineTo(new StringWriter()); if (0 == source.Length) { AbortException.raise() }; - console.writeLine(Transliteration(source)) + Console.writeLine(Transliteration(source)) } } diff --git a/examples60/console/trans/translit.l b/examples60/console/trans/translit.l index e6ab5c05f5..efefaaa990 100644 --- a/examples60/console/trans/translit.l +++ b/examples60/console/trans/translit.l @@ -4,7 +4,7 @@ import extensions; // --- RusLatRules --- -/*const*/ rusLatRules = new object[] +/*const*/ RusLatRules = new object[] { ( "а", "a" ), ( "б", "b" ), @@ -48,7 +48,7 @@ Transliteration(text) text.forEach::(ch) { - var rule := rusLatRules.seekEach:: + var rule := RusLatRules.seekEach:: (x => x.Item1 == ch.toPrintable() ); if (nil == rule) diff --git a/examples60/console/words/words.l b/examples60/console/words/words.l index 2c8616c3d4..6e01158bfb 100644 --- a/examples60/console/words/words.l +++ b/examples60/console/words/words.l @@ -36,11 +36,11 @@ class WordList public program() { - console.writeLine("Enter the text(to stop press enter two times):"); + Console.writeLine("Enter the text(to stop press enter two times):"); // read until the empty string is not entered var text := new StringWriter(); - for(string line := console.readLine(); until line.isEmpty()) + for(string line := Console.readLine(); until line.isEmpty()) { text.writeLine(line) }; @@ -49,9 +49,9 @@ public program() text.forEachWord::(word){ list.append(word) }; - console.printLine("There are ",list.unique_words," unique words out of ",list.total_words); + Console.printLine("There are ",list.unique_words," unique words out of ",list.total_words); if (list.total_words > 0) - { console.printLine("the list of unique words:",list.ascendant()) }; + { Console.printLine("the list of unique words:",list.ascendant()) }; - console.readChar() // wait for any key + Console.readChar() // wait for any key } diff --git a/examples60/files/textdb/textdb.l b/examples60/files/textdb/textdb.l index c1e92ab625..2c4d8546f6 100644 --- a/examples60/files/textdb/textdb.l +++ b/examples60/files/textdb/textdb.l @@ -83,12 +83,12 @@ class Record public program() { - if (program_arguments.Length == 1) + if (Program_arguments.Length == 1) { console.write("Please provide the path to the file to view"); AbortException.raise() }; var db := new List().append(new Record()); - File.assign(program_arguments[1]).forEachLine::(line) + File.assign(Program_arguments[1]).forEachLine::(line) { if (line.Length == 0) { diff --git a/examples60/files/textfile/textfile.l b/examples60/files/textfile/textfile.l index 179f98c0db..5d2ce958d2 100644 --- a/examples60/files/textfile/textfile.l +++ b/examples60/files/textfile/textfile.l @@ -4,10 +4,10 @@ import extensions'routines; public program() { - if (program_arguments.Length == 1) + if (Program_arguments.Length == 1) { console.writeLine("Please provide the path to the file to view"); AbortException.raise() }; - File.assign(program_arguments[1]).forEachLine(printingLn); + File.assign(Program_arguments[1]).forEachLine(printingLn); console.readChar() // wait for any key } \ No newline at end of file diff --git a/examples60/net/chat/client_cui/main.l b/examples60/net/chat/client_cui/main.l index 1ed19ee9bd..9b150b4e0f 100644 --- a/examples60/net/chat/client_cui/main.l +++ b/examples60/net/chat/client_cui/main.l @@ -72,7 +72,7 @@ class Controller _client.send(line) }; - ^ emptyString + ^ EmptyString } } diff --git a/examples60/rosetta/anagram/anagram.l b/examples60/rosetta/anagram/anagram.l index 71899c402e..026d65006b 100644 --- a/examples60/rosetta/anagram/anagram.l +++ b/examples60/rosetta/anagram/anagram.l @@ -15,7 +15,7 @@ extension op public program() { - var start := now; + var start := Now; auto dictionary := new Map(); @@ -37,7 +37,7 @@ public program() .top(20) .forEach::(pair){ console.printLine(pair.Item2) }; - var end := now; + var end := Now; var diff := end - start; diff --git a/examples60/rosetta/brackets/brackets.l b/examples60/rosetta/brackets/brackets.l index 6f7ae5fd27..2fa5b23266 100644 --- a/examples60/rosetta/brackets/brackets.l +++ b/examples60/rosetta/brackets/brackets.l @@ -12,7 +12,7 @@ randomBrackets(len) { if (0 == len) { - ^emptyString + ^ EmptyString } else { diff --git a/examples60/rosetta/treeview/treeview.l b/examples60/rosetta/treeview/treeview.l index f4aa638853..e40f22d2ac 100644 --- a/examples60/rosetta/treeview/treeview.l +++ b/examples60/rosetta/treeview/treeview.l @@ -19,7 +19,7 @@ class Node <= new(value, new Node[](0)); constructor new(Node[] children) - <= new(emptyString, children); + <= new(EmptyString, children); get() = theValue; diff --git a/examples60/scripts/calc/control.l b/examples60/scripts/calc/control.l index 617396b753..72183f9ab1 100644 --- a/examples60/scripts/calc/control.l +++ b/examples60/scripts/calc/control.l @@ -11,7 +11,7 @@ public singleton control { if ("-q" == line) { - forward program.stop(); ^emptyString + forward program.stop(); ^EmptyString } else { diff --git a/examples60/threads/async/asyncsamples.prj b/examples60/threads/async/asyncsamples.prj new file mode 100644 index 0000000000..b9bde150ed --- /dev/null +++ b/examples60/threads/async/asyncsamples.prj @@ -0,0 +1,15 @@ + + + + sample1.l + sample2.l + main.l + + + + asyncsamples + + asyncsamples + + + \ No newline at end of file diff --git a/examples60/threads/async/main.l b/examples60/threads/async/main.l new file mode 100644 index 0000000000..8a9c251c2e --- /dev/null +++ b/examples60/threads/async/main.l @@ -0,0 +1,10 @@ +import extensions; + +public program() +{ + int solution := program_arguments.getAtOrDefault(1, "1").toInt(); + + solution => + 1 { sample1() } + 2 { sample2() } +} \ No newline at end of file diff --git a/examples60/threads/async/sample1.l b/examples60/threads/async/sample1.l new file mode 100644 index 0000000000..ad8aa32776 --- /dev/null +++ b/examples60/threads/async/sample1.l @@ -0,0 +1,30 @@ +import system'threading; + +class Sample1 +{ + async static Task wait() + { + $await Task.sleep(10000); + console.writeLine("10 Seconds wait Completed\n"); + } + + async static Task someMethod() + { + console.writeLine("Some Method Started......"); + $await wait(); + console.writeLine("Some Method End"); + } + + static run() + { + console.writeLine("Main Method Started......"); + someMethod(); + console.writeLine("Main Method End"); + console.readChar(); + } +} + +sample1() +{ + Sample1.run(); +} \ No newline at end of file diff --git a/examples60/threads/async/sample2.l b/examples60/threads/async/sample2.l new file mode 100644 index 0000000000..70cc6eccd7 --- /dev/null +++ b/examples60/threads/async/sample2.l @@ -0,0 +1,25 @@ +import extensions; +import system'threading; + +singleton Tester +{ + async Task getValueAsync() + { + ^ 2 + } + + async Task addValueAsync(int n) + { + int val := $await getValueAsync(); + + val := val + n; + + ^ val + } +} + +sample2() +{ + int n := Tester.addValueAsync(3).Result; + Console.printLine("the result is ", n); +} diff --git a/examples60/threads/tasks/main.l b/examples60/threads/tasks/main.l index eadd1f919b..13d9f9a024 100644 --- a/examples60/threads/tasks/main.l +++ b/examples60/threads/tasks/main.l @@ -2,8 +2,10 @@ import extensions; public program() { - int solution := program_arguments.getAtOrDefault(1, "1").toInt(); + int solution := program_arguments.getAtOrDefault(1, "3").toInt(); solution => 1 { sample1() } + 2 { sample2() } + 3 { sample3() } } \ No newline at end of file diff --git a/examples60/threads/tasks/sample1.l b/examples60/threads/tasks/sample1.l index b74adddd8c..7a8803ba3a 100644 --- a/examples60/threads/tasks/sample1.l +++ b/examples60/threads/tasks/sample1.l @@ -13,7 +13,7 @@ public sample1() auto tasks := new List(); foreach(string dirName; in dirNames) { - Task t := Task.Run( { foreach(auto path; in Directory.getFiles(dirName)) + Task t := Task.run( { foreach(auto path; in Directory.getFiles(dirName)) list.push(path); } ); tasks.append(t); }; diff --git a/examples60/threads/tasks/sample2.l b/examples60/threads/tasks/sample2.l new file mode 100644 index 0000000000..3fdae8b151 --- /dev/null +++ b/examples60/threads/tasks/sample2.l @@ -0,0 +1,28 @@ +import extensions'threading; +import system'threading; + +doWork(string taskName) +{ + Console.printLineConcurrent(taskName," starting"); + + Thread.sleep(1000); + + Console.printLineConcurrent(taskName," complete"); +} + +sample2() +{ + // setting several tasks + Task task1 := Task.assign({ doWork("Task 1") }); + Task task2 := Task.assign({ doWork("Task 2") }); + Task task3 := Task.assign({ doWork("Task 3") }); + + // starting the tasks + task1.start(); + task2.start(); + task3.start(); + + Console.printLineConcurrent("Waiting for Tasks to complete"); + Task.waitAllArgs(task1, task2, task3); + Console.printLineConcurrent("All Tasks are complete"); +} \ No newline at end of file diff --git a/examples60/threads/tasks/sample3.l b/examples60/threads/tasks/sample3.l new file mode 100644 index 0000000000..95ba22af68 --- /dev/null +++ b/examples60/threads/tasks/sample3.l @@ -0,0 +1,22 @@ +import extensions; +import system'threading; +import system'routines; +import system'collections; + +static int[] Numbers = class List.load(Range.for(0, 30000).enumerator()).Value; + +sample3() +{ + auto task := class Task.run({ + long total := 0; + for (int i := 0; i < Numbers.Length; i++) + { + total += Numbers[i]; + }; + ^ total; + }); + + Console.writeLine("Doing some other work..."); + + Console.printLine("Sum is ", task.Result); +} diff --git a/examples60/threads/tasks/tasksamples.prj b/examples60/threads/tasks/tasksamples.prj index 54931284dd..556c41af89 100644 --- a/examples60/threads/tasks/tasksamples.prj +++ b/examples60/threads/tasks/tasksamples.prj @@ -2,6 +2,8 @@ sample1.l + sample2.l + sample3.l main.l diff --git a/examples60/threads/threadpool/sample1.l b/examples60/threads/threadpool/sample1.l index 430782d2fd..7b3bf084dc 100644 --- a/examples60/threads/threadpool/sample1.l +++ b/examples60/threads/threadpool/sample1.l @@ -4,14 +4,14 @@ import extensions'threading; WorkItem1(state) { - console.writeLine($"WorkItem1: {state}"); + Console.printLineConcurrent("WorkItem1: ", state); } WorkItem2(state) { int num := state.toInt(); int square := num * num; - console.writeLine($"WorkItem2: {num} * {num} = {square}"); + Console.printLineConcurrent($"WorkItem2: {num} * {num} = {square}"); } public sample1() @@ -21,5 +21,5 @@ public sample1() Thread.sleep(1000); - console.writeLine("Main thread exits") + Console.printLineConcurrent("Main thread exits") } \ No newline at end of file diff --git a/examples60/threads/threadpool/sample2.l b/examples60/threads/threadpool/sample2.l index 0cf62614c4..9eed4fd9df 100644 --- a/examples60/threads/threadpool/sample2.l +++ b/examples60/threads/threadpool/sample2.l @@ -4,18 +4,14 @@ import extensions'threading; WorkItem3(state) { - lock(console) { - console.writeLine("WorkItem1"); - }; + Console.printLineConcurrent("WorkItem1"); state.signal() } WorkItem4(state) { - lock(console) { - console.writeLine("WorkItem2"); - }; + Console.printLineConcurrent("WorkItem2"); state.signal() } @@ -29,5 +25,5 @@ public sample2() event.wait(); - console.writeLine("Main thread exits") + Console.writeLine("Main thread exits") } \ No newline at end of file diff --git a/src60/extensions/app.l b/src60/extensions/app.l index 70a5c9d8ec..fd506083b4 100644 --- a/src60/extensions/app.l +++ b/src60/extensions/app.l @@ -1,6 +1,6 @@ // --- ProgramLoop --- -class ProgramLoop +class ProgramLoopImpl { bool _active; object _control; @@ -19,9 +19,9 @@ class ProgramLoop function() { // if grettings is not defined - do nothing - console.printLine(_control.greeting() ?? emptyString); + console.printLine(_control.greeting() ?? EmptyString); - var prompt := _control.Prompt ?? emptyString; + var prompt := _control.Prompt ?? EmptyString; while (_active) { @@ -32,4 +32,4 @@ class ProgramLoop } } -public static programLoop = ProgramLoop.assign(forward program'control); +public static ProgramLoop = ProgramLoopImpl.assign(forward program'control); diff --git a/src60/extensions/basic.l b/src60/extensions/basic.l index 9d645c2560..52d0bedd17 100644 --- a/src60/extensions/basic.l +++ b/src60/extensions/basic.l @@ -112,7 +112,7 @@ public extension objectExOp getAtOrDefault(int index, default) { if (self.Length > index) { - ^ self.getAt(index) ?? default; + ^ self.at(index) ?? default; }; ^ default diff --git a/src60/extensions/convertors.l b/src60/extensions/convertors.l index 6b2f69de57..59620319e9 100644 --- a/src60/extensions/convertors.l +++ b/src60/extensions/convertors.l @@ -122,7 +122,7 @@ public singleton intmatrixExConvertor l -= 1; output.Length := l; - output.write(newLineConstant) + output.write(NewLineConstant) }; ^ output.Value @@ -147,7 +147,7 @@ public singleton intmatrixExConvertor l -= 1; output.Length := l; - output.write(newLineConstant) + output.write(NewLineConstant) }; wide ret := output.Value; diff --git a/src60/extensions/extensions.prj b/src60/extensions/extensions.prj index 9145c52a85..a212ee73fd 100644 --- a/src60/extensions/extensions.prj +++ b/src60/extensions/extensions.prj @@ -40,6 +40,9 @@ routines\combinations.l routines\compound.l + + routines\stex\convertors.l + scripting\interpreter.l scripting\win_scripts.l @@ -51,6 +54,7 @@ threading\threading.l + threading\console.l runtime\systemmonitor.l diff --git a/src60/extensions/io/bytearray.l b/src60/extensions/io/bytearray.l index eb265d954f..78ce9f8a0e 100644 --- a/src60/extensions/io/bytearray.l +++ b/src60/extensions/io/bytearray.l @@ -68,15 +68,19 @@ namespace io _position := _end } - read(byte[] array, ref int actualLength) + int read(byte[] array, int length) { + int actualLen := length; + int remaining := _end - _position; - if (remaining < actualLength) { - actualLength := remaining + if (remaining < length) { + actualLen := remaining } - else remaining := actualLength; + else remaining := length; Array.copy(array, _buffer, _position, remaining); + + ^ actualLen } } diff --git a/src60/extensions/lnx_args.l b/src60/extensions/lnx_args.l index 23b7c1ad24..c13350a2dd 100644 --- a/src60/extensions/lnx_args.l +++ b/src60/extensions/lnx_args.l @@ -1,5 +1,8 @@ // --- Arguments --- -public static program_arguments = - commandLineArguments; +public static Program_arguments = + CommandLineArguments; + +// obosolete +public program_arguments = Program_arguments; \ No newline at end of file diff --git a/src60/extensions/math/matrix.l b/src60/extensions/math/matrix.l index be9bbf8d21..11dfefc128 100644 --- a/src60/extensions/math/matrix.l +++ b/src60/extensions/math/matrix.l @@ -255,7 +255,7 @@ namespace math int l := output.Length; output.Length := l - 1; - output.write(newLineConstant); + output.write(NewLineConstant); }; ^ output.Value diff --git a/src60/extensions/random.l b/src60/extensions/random.l index 3ab7710faf..dd26d12fd1 100644 --- a/src60/extensions/random.l +++ b/src60/extensions/random.l @@ -12,7 +12,7 @@ public sealed struct RandomGenerator { Seed _seed; - internal constructor() + internal constructor new() { extern GetRandomSeedLA(_seed); } @@ -57,7 +57,7 @@ public sealed struct RandomGenerator } // --- randomGenerator --- -public static RandomGenerator randomGenerator = new RandomGenerator(); +public static RandomGenerator randomGenerator = RandomGenerator.new(); // -- ERandomizer -- diff --git a/src60/extensions/routines/stex/convertors.l b/src60/extensions/routines/stex/convertors.l new file mode 100644 index 0000000000..f971795246 --- /dev/null +++ b/src60/extensions/routines/stex/convertors.l @@ -0,0 +1,15 @@ +import system'collections; + +public extension EnumConvertorOp : Enumerator +{ + T[] toArray() + { + auto list := new List(); + + foreach(T item; in self) { + list.append(item); + }; + + ^ list.Value + } +} \ No newline at end of file diff --git a/src60/extensions/text/strings.l b/src60/extensions/text/strings.l index 620690e7a9..2c43697bfc 100644 --- a/src60/extensions/text/strings.l +++ b/src60/extensions/text/strings.l @@ -9,7 +9,7 @@ namespace text constructor() { - _value := emptyString; + _value := EmptyString; _index := 0; _start := 0 } @@ -125,7 +125,7 @@ namespace text clear() { - _value := emptyString; + _value := EmptyString; _index := 0; _start := 0 } @@ -163,8 +163,8 @@ namespace text constructor() { - _value := emptyString; - _newLine := newLineConstant; + _value := EmptyString; + _newLine := NewLineConstant; } constructor load(string s) @@ -174,8 +174,8 @@ namespace text constructor(string s, int count) { - _value := emptyString; - _newLine := newLineConstant; + _value := EmptyString; + _newLine := NewLineConstant; for (int i := 0; i < count; i += 1) { @@ -226,7 +226,7 @@ namespace text clear() { - _value := emptyString + _value := EmptyString } string toPrintable() = _value; diff --git a/src60/extensions/threading/console.l b/src60/extensions/threading/console.l new file mode 100644 index 0000000000..28f8f79b5a --- /dev/null +++ b/src60/extensions/threading/console.l @@ -0,0 +1,15 @@ +import extensions; + +// --- outputOp --- + +static sync = new object(); + +public extension outputConcurrentOp +{ + printLineConcurrent(params object[] list) + { + lock(sync) { + self.printLine(params list); + } + } +} \ No newline at end of file diff --git a/src60/extensions/win_args.l b/src60/extensions/win_args.l index b64c17d3d8..1f35fa94ec 100644 --- a/src60/extensions/win_args.l +++ b/src60/extensions/win_args.l @@ -2,5 +2,9 @@ import system'routines; // --- program_arguments --- -public static program_arguments = - new extensions'text'TokenEnumerator(commandLine.toString(), new extensions'text'TokenStatemachine()).selectBy::(s => s.trim($34)).toArray(); +public static Program_arguments = + new extensions'text'TokenEnumerator(CommandLine.toString(), new extensions'text'TokenStatemachine()).selectBy::(s => s.trim($34)).toArray(); + +// obosolete +public program_arguments = Program_arguments; + \ No newline at end of file diff --git a/src60/system/app.l b/src60/system/app.l index c9f4157c75..ca9cec8b81 100644 --- a/src60/system/app.l +++ b/src60/system/app.l @@ -6,7 +6,7 @@ public sealed class StartUpEvents Func1 OnError : event; - internal constructor() {} + internal constructor new() {} internal stopping() { @@ -19,7 +19,7 @@ public sealed class StartUpEvents } } -public static StartUpEvents startUpEvents = new StartUpEvents(); +public static StartUpEvents startUpEvents = StartUpEvents.new(); entry() { diff --git a/src60/system/attributes/attributes.l b/src60/system/attributes/attributes.l index 9c6a647be2..3bc44525e7 100644 --- a/src60/system/attributes/attributes.l +++ b/src60/system/attributes/attributes.l @@ -1,7 +1,10 @@ #new attributes; /// modificator: -#let attributes["__ignore_duplicates"] := 80006001h; +#let attributes["__ignore_duplicates"] := 80007001h; + +/// method attributes: +#let attributes["indexed"] := 80006001h; /// scope_accessors: #let attributes["get"] := 80005001h; diff --git a/src60/system/calendar/dates.l b/src60/system/calendar/dates.l index 4c53845d58..eeeaf4a9c8 100644 --- a/src60/system/calendar/dates.l +++ b/src60/system/calendar/dates.l @@ -389,9 +389,12 @@ namespace calendar = new Date(_value); } - // --- now --- - public Date now = Date.Now; - + // --- obsolete --- + public Date now = Date.Now; + // --- obsolete --- public Date utcNow = Date.UtcNow; + // --- now --- + public Date Now = Date.Now; + public Date UtcNow = Date.UtcNow; } \ No newline at end of file diff --git a/src60/system/closures.l b/src60/system/closures.l index 4e94e2114d..5619450a80 100644 --- a/src60/system/closures.l +++ b/src60/system/closures.l @@ -22,6 +22,11 @@ public interface Func } } +public interface Func : Func +{ + abstract TResult function(); +} + // --- Func1 --- public interface Func1 diff --git a/src60/system/collections/list.l b/src60/system/collections/list.l index 8cd680744a..a6dc60e858 100644 --- a/src60/system/collections/list.l +++ b/src60/system/collections/list.l @@ -881,6 +881,18 @@ namespace collections _array := new T[](16); } + constructor load(source) + <= load(cast Enumerator(source)); + + constructor load(Enumerator e) + { + _capacity := 16; + _length := 0; + _array := new T[](16); + + self.appendRange(e) + } + constructor load(T[] a, int index, int len) { int size := len / 32; diff --git a/src60/system/console.l b/src60/system/console.l index 2058704995..6d2532c56a 100644 --- a/src60/system/console.l +++ b/src60/system/console.l @@ -25,12 +25,12 @@ public interface IConsoleWriter abstract refresh(); } -public sealed class Console +public sealed class ConsoleHelperImpl { IConsoleReader reader; IConsoleWriter writer; - internal constructor(IConsoleReader reader, IConsoleWriter writer) + constructor new(IConsoleReader reader, IConsoleWriter writer) { this reader := reader; this writer := writer; @@ -45,13 +45,13 @@ public sealed class Console writeLine(s) : info("Writes the specified literal value, followed by the current line terminator, to the standard output stream.") { - writer.write(s.toPrintable()); - writer.write(newLineConstant); + ConsoleHelper.write(s.toPrintable()); + ConsoleHelper.write(NewLineConstant); } writeLine() { - writer.write(newLineConstant); + writer.write(NewLineConstant); } char readChar() @@ -80,6 +80,44 @@ public sealed class Console wide readWideLine() : info("Reads the next line of characters from the standard input stream.") = reader.readWideLine(); + +} + +static ConsoleHelperImpl ConsoleHelper = ConsoleHelperImpl.new(io'stdConsoleReader, io'stdConsoleWriter); + +public singleton Console +{ + write(s) + : info("Writes the specified literal value to the standard output stream.") + => ConsoleHelper; + + writeLine(s) + : info("Writes the specified literal value, followed by the current line terminator, to the standard output stream.") + => ConsoleHelper; + + writeLine() + => ConsoleHelper; + + char readChar() : info("Reads the next character from the input stream") + => ConsoleHelper; + + get bool KeyAvailable() + => ConsoleHelper; + + setCursorPosition(int x, int y) + => ConsoleHelper; + + clear() + => ConsoleHelper; + + string readLine() + : info("Reads the next line of characters from the standard input stream.") + => ConsoleHelper; + + wide readWideLine() + : info("Reads the next line of characters from the standard input stream.") + => ConsoleHelper; } -public static Console console = new Console(io'stdConsoleReader, io'stdConsoleWriter); +// obsolete +public ConsoleHelperImpl console = ConsoleHelper; diff --git a/src60/system/extensions.l b/src60/system/extensions.l index 9496a83e39..c9ab8626bb 100644 --- a/src60/system/extensions.l +++ b/src60/system/extensions.l @@ -1001,7 +1001,7 @@ public extension stringOp : String ^ self.Substring(index, len) }; - ^ emptyString + ^ EmptyString } int indexOf(string s) @@ -1114,7 +1114,7 @@ public extension stringOp : String index += chLen }; - ^ emptyString + ^ EmptyString } string trimLeft() @@ -1139,7 +1139,7 @@ public extension stringOp : String index -= chLen }; - ^ emptyString + ^ EmptyString } string trimRight() @@ -1153,7 +1153,7 @@ public extension stringOp : String string replace(string replacee, string replacer) { - string target := emptyString; + string target := EmptyString; int start := 0; int end := self.indexOf(start, replacee); int replaceeLen := replacee.Length; diff --git a/src60/system/io/common.l b/src60/system/io/common.l index 60115c4278..d81706a76f 100644 --- a/src60/system/io/common.l +++ b/src60/system/io/common.l @@ -35,7 +35,7 @@ namespace io self.Index := newIndex } - abstract read(byte[] dump, ref int length); + abstract int read(byte[] dump, int length); abstract write(byte[] dump, int length); diff --git a/src60/system/io/files.l b/src60/system/io/files.l index 24c4665300..3af6e102b0 100644 --- a/src60/system/io/files.l +++ b/src60/system/io/files.l @@ -37,14 +37,28 @@ namespace io saveContent(string content) { - using(TextWriter writer := fileControl.writer(_path)) { - writer.write(content); - } + File.saveContent(_path, content); } - private read(TextBuilder output) + string readContent() + = File.readContent(_path); + + wide readWideContent() + = File.readWideContent(_path); + + delete() + = fileControl.delete(_path); + + static saveContent(string path, string content) + { + using(TextWriter writer := fileControl.writer(path)) { + writer.write(content); + } + } + + static readContentTo(string path, TextBuilder output) { - using(TextReader reader := fileControl.newReader(_path)) { + using(TextReader reader := fileControl.newReader(path)) { char buffer[128]; int read := 0; while (reader.Available) @@ -54,30 +68,26 @@ namespace io output.write(buffer, read) }; - } + } } - string readContent() + static string readContent(string path) { auto output := new TextBuilder(); - self.read(output); + File.readContentTo(path, output); ^ output.Value } - - wide readWideContent() + + static wide readWideContent(string path) { auto output := new TextBuilder(); - self.read(output); + File.readContentTo(path, output); ^ output.Value } - - delete() - = fileControl.delete(_path); - } // --- Directory --- diff --git a/src60/system/io/lnx_console.l b/src60/system/io/lnx_console.l index 454675b2b7..eda24a6852 100644 --- a/src60/system/io/lnx_console.l +++ b/src60/system/io/lnx_console.l @@ -114,7 +114,7 @@ namespace io { byte buffer[127]; int length := 0; - var output := emptyString; + var output := EmptyString; bool continue := true; while(continue) diff --git a/src60/system/io/memorystream.l b/src60/system/io/memorystream.l index 0a7132ef27..3312e61aa7 100644 --- a/src60/system/io/memorystream.l +++ b/src60/system/io/memorystream.l @@ -183,15 +183,15 @@ namespace io _buffer.write(index, length, dump) } - read(byte[] dump, ref int len) + int read(byte[] dump, int len) { int pos := _position.Value; _buffer.read(pos, len, dump); - pos := len; - - _position.append(pos); + _position.append(len); + + ^ len } int Index diff --git a/src60/system/io/streamreader.l b/src60/system/io/streamreader.l index 637a1a0033..ca20e99d47 100644 --- a/src60/system/io/streamreader.l +++ b/src60/system/io/streamreader.l @@ -6,7 +6,7 @@ namespace io public interface BinaryReader { - abstract read(byte[] array, ref int actualLength); + abstract int read(byte[] array, int length); get abstract object Source(); @@ -14,11 +14,9 @@ namespace io get abstract bool Available(); - read(byte[] array, int length) + readExact(byte[] array, int length) { - int read := length; - - self.read(array, ref read); + int read := self.read(array, length); if(length > read) { IOException.new("Cannot read the specified amount").raise() } @@ -27,12 +25,7 @@ namespace io read(ref byte int) { byte buffer[4]; - int read := 1; - - self.read(buffer, ref read); - - if (read < 1) - { IOException.new("Cannot read the specified amount").raise() }; + self.readExact(buffer, 1); byte b := buffer[0]; @@ -42,12 +35,8 @@ namespace io read(ref short int) { byte buffer[4]; - int read := 2; - self.read(buffer, ref read); - - if (read < 2) - { IOException.new("Cannot read the specified amount").raise() }; + self.readExact(buffer, 2); PrimitiveIntOperations.loadFromByteArray(buffer, 0, ref int retVal := 0); @@ -58,13 +47,8 @@ namespace io read(ref char ch) { byte buffer[4]; - int read := 4; - - self.read(buffer, ref read); - if (read < 4) - { IOException.new("Cannot read the specified amount").raise() }; - + self.readExact(buffer, 4); PrimitiveIntOperations.loadFromByteArray(buffer, 0, ref int retVal := 0); @@ -75,12 +59,8 @@ namespace io read(ref int int) { byte buffer[4]; - int read := 4; - self.read(buffer, ref read); - - if (read < 4) - { IOException.new("Cannot read the specified amount").raise() }; + self.readExact(buffer, 4); PrimitiveIntOperations.loadFromByteArray(buffer, 0, ref int retVal := 0); @@ -90,12 +70,8 @@ namespace io read(ref long long) { byte buffer[8]; - int read := 8; - - self.read(buffer, ref read); - if (read < 8) - { IOException.new("Cannot read the specified amount").raise() }; + self.readExact(buffer, 8); PrimitiveLongOperations.loadFromByteArray(buffer, 0, ref long retVal := 0l); @@ -105,12 +81,8 @@ namespace io read(ref real real) { byte buffer[8]; - int read := 8; - - self.read(buffer, ref read); - if (read < 8) - { IOException.new("Cannot read the specified amount").raise() }; + self.readExact(buffer, 8); PrimitiveRealOperations.loadFromByteArray(buffer, 0, ref real retVal := 0.0); @@ -138,16 +110,16 @@ namespace io ^ position < _stream.Length } - read(byte[] array, ref int actualLength) + int read(byte[] array, int actualLength) { - _stream.read(array, ref actualLength) + ^ _stream.read(array, actualLength) } } // --- TextReader --- public interface TextReader { - abstract read(char[] array, ref int actualLength); + abstract int read(char[] array, int length); get abstract object Source(); @@ -171,7 +143,7 @@ namespace io string readLine() { - string line := emptyString; + string line := EmptyString; int len := -1; while (len == -1) @@ -183,7 +155,7 @@ namespace io char buffer[64]; int bufferLen := 64; - self.read(buffer, ref bufferLen); + bufferLen := self.read(buffer, bufferLen); if(bufferLen == 0) { len := -2 // !! to indicate the eof @@ -225,7 +197,7 @@ namespace io char buffer[64]; int bufferLen := 64; - self.read(buffer, ref bufferLen); + bufferLen := self.read(buffer, bufferLen); if(bufferLen == 0) { len := -2 // !! to indicate the eof @@ -262,7 +234,7 @@ namespace io constructor new(Stream stream, Encoder encoder) { _output := new TextBuilder(); - _newLineConstant := newLineConstant; + _newLineConstant := NewLineConstant; _newLineLength := _newLineConstant.Length; _stream := stream; @@ -282,25 +254,26 @@ namespace io Encoder Encoder = _encoder; - read(char[] output, ref int length) + int read(char[] output, int length) { int bufferLength := 64; byte buffer[64]; - _stream.read(buffer, ref bufferLength); - if(bufferLength == 0) + int actualLen := _stream.read(buffer, bufferLength); + if(actualLen == 0) { _open := false; - length := 0; } else { - int read := bufferLength; + int read := actualLen; - _encoder.convertFrom(buffer, 0, ref bufferLength, output, 0, ref length); + actualLen := _encoder.convertFrom(buffer, 0, ref read, output, 0, length); if(read > bufferLength) { _stream.reduceIndex(read - bufferLength) } - } + }; + + ^ actualLen } close() diff --git a/src60/system/io/streamwriter.l b/src60/system/io/streamwriter.l index b4c5c4fe55..92fdf61d96 100644 --- a/src60/system/io/streamwriter.l +++ b/src60/system/io/streamwriter.l @@ -186,7 +186,7 @@ namespace io _stream := stream; _encoder := encoder; - _newLineConstant := newLineConstant; + _newLineConstant := NewLineConstant; _newLineLength := _newLineConstant.Length; } diff --git a/src60/system/io/threading/async_common.l b/src60/system/io/threading/async_common.l new file mode 100644 index 0000000000..0bb2f312d8 --- /dev/null +++ b/src60/system/io/threading/async_common.l @@ -0,0 +1,13 @@ +import system'io; +import system'threading; + +public extension asyncStreamOp : Stream +{ + Task writeAsync(byte[] dump, int length) + = Task.run( { self.write(dump, length); }); + + Task readAsync(byte[] dump, int length) + { + ^ class Task.run( { ^ self.read(dump, length); }); + } +} \ No newline at end of file diff --git a/src60/system/io/win_files.l b/src60/system/io/win_files.l index 50e9a749d0..5c919488cc 100644 --- a/src60/system/io/win_files.l +++ b/src60/system/io/win_files.l @@ -64,19 +64,17 @@ namespace io 0) } - read(byte[] dump, ref int retVal) + int read(byte[] dump, int len) { - int toRead := retVal; - extern KERNEL32.ReadFile( _handle, dump, - toRead, + len, //ref retVal, out int temp, 0); - retVal := temp + ^ temp } int Index diff --git a/src60/system/lnx_app.l b/src60/system/lnx_app.l index 7af9e70bb8..79da097eff 100644 --- a/src60/system/lnx_app.l +++ b/src60/system/lnx_app.l @@ -19,5 +19,5 @@ singleton CommandLineFactory } } -public commandLineArguments = +public CommandLineArguments = CommandLineFactory.load(); diff --git a/src60/system/lnx_strings.l b/src60/system/lnx_strings.l index eb8474bc8f..4ee7a62ffe 100644 --- a/src60/system/lnx_strings.l +++ b/src60/system/lnx_strings.l @@ -1,2 +1,2 @@ -public const string newLineConstant +public const string NewLineConstant = ""$10; diff --git a/src60/system/pointers.l b/src60/system/pointers.l index 73dde67740..2d83d7f3fa 100644 --- a/src60/system/pointers.l +++ b/src60/system/pointers.l @@ -131,14 +131,14 @@ public sealed class CallStack byte buffer[512]; int bufferLength := 0; pointer address; - string callStackText := emptyString; + string callStackText := EmptyString; int length := stack.Length; for (int i := 1; i < length; i += 1) { address := stack[i]; bufferLength := extern LoadAddressInfoLM(address, buffer, 512); if (bufferLength > 0) { - callStackText := callStackText + String.fromByteArray(0, bufferLength, buffer).add(newLineConstant) + callStackText := callStackText + String.fromByteArray(0, bufferLength, buffer).add(NewLineConstant) } }; diff --git a/src60/system/strings.l b/src60/system/strings.l index 1a8841a4d0..9e1bf96212 100644 --- a/src60/system/strings.l +++ b/src60/system/strings.l @@ -1023,6 +1023,9 @@ public const struct String : BaseValue, string clone() = String.copy(self); } +public const String EmptyString = String.MinValue; + +// obsolete public const String emptyString = String.MinValue; // --- StringEnumerator --- diff --git a/src60/system/system.prj b/src60/system/system.prj index c495b87c78..b21c0f239c 100644 --- a/src60/system/system.prj +++ b/src60/system/system.prj @@ -16,7 +16,7 @@ ELENA Standard Library - 6.3.1 + 6.4.3 Aleksey Rakov @@ -113,6 +113,9 @@ threading\templates.l threading\template_tests.l + + io\threading\async_common.l + dynamic\reflection.l dynamic\interpreters.l diff --git a/src60/system/system.project b/src60/system/system.project index c3d44a66d1..055803d22e 100644 --- a/src60/system/system.project +++ b/src60/system/system.project @@ -50,7 +50,7 @@ ELENA Standard Library - 6.3.1 + 6.4.3 Aleksey Rakov diff --git a/src60/system/text/encoding.l b/src60/system/text/encoding.l index c25dcaf170..b9cc9a6972 100644 --- a/src60/system/text/encoding.l +++ b/src60/system/text/encoding.l @@ -1,13 +1,13 @@ - namespace text +namespace text { // --- Encoder --- public interface Encoder { - abstract convertChar(char ch, byte[] byteArray, int index, ref int length); + abstract int convertChar(char ch, byte[] byteArray, int index); abstract char convertToChar(byte[] byteArray, int index, ref int length); - convertFrom(byte[] byteArray, int index, ref int len, char[] output, int outputIndex, ref int outputLen) + int convertFrom(byte[] byteArray, int index, ref int len, char[] output, int outputIndex, int outputLen) { int i := 0; int j := outputIndex; @@ -19,24 +19,24 @@ j += 1; }; - outputLen := j - outputIndex; + ^ j - outputIndex; } - convertTo(char[] chars, int index, ref int len, byte[] output, int outputIndex, ref int outputLen) + int convertTo(char[] chars, int index, ref int len, byte[] output, int outputIndex, int outputLen) { int j := outputIndex; for (int i := 0; i < len; i += 1) { char ch := chars[i + index]; - self.convertChar(ch, output, j, ref int chLen); + int chLen := self.convertChar(ch, output, j); j += chLen; }; - outputLen := j - outputIndex; + ^ j - outputIndex; } - toByteArray(string s, int index, ref int length, byte[] output, int outputIndex, ref int outputLength) + int toByteArray(string s, int index, ref int length, byte[] output, int outputIndex, int outputLength) { char tmp[128]; int end := length; @@ -58,13 +58,13 @@ length := i - index; - self.convertTo(tmp, 0, j, output, outputIndex, ref outputLength); + ^ self.convertTo(tmp, 0, j, output, outputIndex, outputLength); } string toString(int index, int length, byte[] buffer) { char tmp[128]; - string retVal := emptyString; + string retVal := EmptyString; int i := index; int len := length; int subLen := 128; @@ -72,7 +72,7 @@ if (len < subLen) subLen := len; - self.convertFrom(buffer, i, ref subLen, tmp, 0, ref int outputLen); + int outputLen := self.convertFrom(buffer, i, ref subLen, tmp, 0, 128); retVal := retVal + String.copy(0, outputLen, tmp); @@ -94,7 +94,7 @@ if (len < subLen) subLen := len; - self.convertFrom(buffer, i, ref subLen, tmp, 0, ref int outputLen); + int outputLen := self.convertFrom(buffer, i, ref subLen, tmp, 0, 128); retVal := retVal + WideString.copy(0, outputLen, tmp); @@ -185,12 +185,12 @@ // --- UTF8Encoder --- public sealed singleton UTF8Encoder : Encoder { - convertChar(char ch, byte[] byteArray, int index, out int length) + int convertChar(char ch, byte[] byteArray, int index) { int value := ch; int byteLen := byteArray.Length; - length := UTFOperations.convertUTF32_2_8(value, byteArray, index, byteLen); + ^ UTFOperations.convertUTF32_2_8(value, byteArray, index, byteLen); } char convertToChar(byte[] byteArray, int index, out int sourLen) @@ -205,7 +205,7 @@ // --- UTF16Encoder --- public sealed singleton UTF16Encoder : Encoder { - convertChar(char ch, byte[] byteArray, int index, out int length) + int convertChar(char ch, byte[] byteArray, int index) { int value := ch; short tmp[2]; @@ -217,7 +217,7 @@ byteArray[index] := lo; byteArray[index + 1] := hi; - length := 2; + int length := 2; if (tmpLen == 2) { hi := tmp[1].High; @@ -227,6 +227,8 @@ length := 4; }; + + ^ length; } char convertToChar(byte[] byteArray, int index, out int chLen) diff --git a/src60/system/text/textbuffer.l b/src60/system/text/textbuffer.l index 063769c64c..ff79144a5e 100644 --- a/src60/system/text/textbuffer.l +++ b/src60/system/text/textbuffer.l @@ -62,7 +62,7 @@ namespace text writeLine() { - self.write(newLineConstant) + self.write(NewLineConstant) } append(line) @@ -420,7 +420,7 @@ namespace text string Substring(int index, int length) { if (length == 0) - { ^ emptyString }; + { ^ EmptyString }; ^ String.copy(index, length, _buffer) } @@ -489,7 +489,7 @@ namespace text { reserve(4); - UTF8Encoder.convertChar(ch, _buffer, *_length, out int len); + int len := UTF8Encoder.convertChar(ch, _buffer, *_length); _length.append(len) } @@ -518,7 +518,7 @@ namespace text self.reserve(4); byte tmp[4]; - UTF8Encoder.convertChar(ch, tmp, 0, ref int len := 4); + int len := UTF8Encoder.convertChar(ch, tmp, 0); Array.move(_buffer, index, current, len); Array.copyTo(_buffer, tmp, index, len); diff --git a/src60/system/text/win_encoding.l b/src60/system/text/win_encoding.l index 7807e0d2c8..d189be1556 100644 --- a/src60/system/text/win_encoding.l +++ b/src60/system/text/win_encoding.l @@ -12,7 +12,7 @@ namespace text this codePage := codePage; } - convertChar(char ch, byte[] byteArray, int index, out int length) + int convertChar(char ch, byte[] byteArray, int index) { byte buffer[4]; short tmp[4]; @@ -23,13 +23,13 @@ namespace text int retVal := extern KERNEL32.WideCharToMultiByte( codePage, 0, tmp, - tmpLen, buffer, length, 0, 0); + tmpLen, buffer, 4, 0, 0); for (int i := 0; i < retVal; i += 1) { byteArray[index + i] := buffer[i] }; - length := retVal; + ^ retVal; } char convertToChar(byte[] byteArray, int index, out int length) diff --git a/src60/system/threading/tasks.l b/src60/system/threading/tasks.l index 554801db47..d760a0f279 100644 --- a/src60/system/threading/tasks.l +++ b/src60/system/threading/tasks.l @@ -1,18 +1,39 @@ import system; -public sealed class Task +public class Task { bool _completed; Exception _exception; Action _continuation; - internal constructor() + Func _action; + + protected constructor() { _completed := false; } - internal Exception Exception + internal constructor newPromise() + { + } + + constructor assign(Func action) + { + _action := action; + } + + indexed get Result() + { + wait(); + + ^ nil; + } + + indexed internal getResultUnsafe() + = nil; + + indexed internal Exception Exception { get() = _exception; @@ -31,7 +52,7 @@ public sealed class Task } } - continueWith(Action action) + sealed continueWith(Action action) { lock(self) { continueWithUnsafe(action); @@ -54,14 +75,18 @@ public sealed class Task } } - setResult() + internal sealed setResult() <= complete(nil); - setException(Exception ex) + internal sealed setException(Exception ex) <= complete(ex); - wait() + sealed wait() { + if (_completed) { + ^ self + }; + ManualResetEvent mres := nil; lock (self) { @@ -79,6 +104,22 @@ public sealed class Task } } + sealed start() + { + ThreadPool.queueAction( + { + try + { + _action(); + setResult(); + } + catch (Exception e) + { + setException(e); + } + }); + } + static Task whenAllArgs(params Task[] tasks) { auto t := new Task(); @@ -88,9 +129,9 @@ public sealed class Task Exception e := nil; - Action continuation := (Task t) + Action continuation := (Task completed) { - e := e ?? t.Exception; + e := e ?? completed.Exception; lock(t) { remaining := remaining - 1; }; @@ -146,7 +187,14 @@ public sealed class Task t.wait() } - static Task Run(Func action) + static waitAllArgs(params Task[] tasks) + { + auto t := whenAllArgs(params tasks); + + t.wait() + } + + static Task run(Func action) { auto t := new Task(); @@ -165,4 +213,68 @@ public sealed class Task ^ t; } + + static Task sleep(int msecs) + = run({ Thread.sleep(msecs); }); +} + +// --- Task --- + +public sealed class Task : Task +{ + TResult _result; + + protected constructor() + { + _completed := false; + } + + constructor(TResult retVal) + { + _result := retVal; + _completed := true; + } + + internal constructor newPromise() + { + } + + constructor assign(Func func) + { + _action := + { + TResult retVal := func(); + + setResultValue(retVal); + }; + } + + indexed internal setResultValue(TResult r) + { + lock(self) { + _result := r + } + } + + indexed internal TResult getResultUnsafe() + = _result; + + indexed get TResult Result() + { + wait(); + + ^ _result; + } + + TResult cast() + = self.Result; + + static Task run(Func action) + { + auto t := class Task.assign(action); + + t.start(); + + ^ t; + } } \ No newline at end of file diff --git a/src60/system/threading/template_tests.l b/src60/system/threading/template_tests.l index 36953b11b1..05c3de65d6 100644 --- a/src60/system/threading/template_tests.l +++ b/src60/system/threading/template_tests.l @@ -4,4 +4,5 @@ T1; threadsafe_collections_template_test() { BlockingQueue o1 := nil; + Task o2 := nil; } diff --git a/src60/system/threading/templates.l b/src60/system/threading/templates.l index c5f5e1bfbe..49eeb75b07 100644 --- a/src60/system/threading/templates.l +++ b/src60/system/threading/templates.l @@ -1,6 +1,6 @@ import system; -public abstract class AsyncStateEnumerator: Enumerator +public abstract class AsyncStateEnumerator : Enumerator { private __context; // context must be the first one private Task __current; @@ -19,7 +19,7 @@ public abstract class AsyncStateEnumerator: Enumerator static Task proceed(Enumerator e) { - Task t := new Task(); + Task t := Task.newPromise(); Action proceeding := (Task tsk) { @@ -29,14 +29,60 @@ public abstract class AsyncStateEnumerator: Enumerator (*e).continueWith(this self); ^ this self; - } + }; + + t.setResult(); } catch (Exception e) { t.setException(e); }; + }; + + proceeding(t); + + ^ t; + } +} + +public abstract class AsyncStateEnumerator : Enumerator +{ + private __context; // context must be the first one + private Task __current; + + get Task Value() + = __current; + + reset() + { + NotSupportedException.raise() + } - t.setResult(); + Enumerator cast() = new Enumerator { embeddable dispatch() => self; }; + + enumerable() = self; + + static Task proceed(Enumerator e) + { + Task t := class Task.newPromise(); + + Action proceeding := (Task tsk) + { + try + { + if (e.next()) { + (*e).continueWith(this self); + + ^ this self; + } + else t.setResultValue((*e).getResultUnsafe()); + + t.setResult(); + } + catch (Exception e) + { + t.setException(e); + }; }; proceeding(t); diff --git a/src60/system/win_app.l b/src60/system/win_app.l index c867793604..42d83514f4 100644 --- a/src60/system/win_app.l +++ b/src60/system/win_app.l @@ -8,5 +8,5 @@ singleton CommandLineFactory } } -public commandLine = +public CommandLine = CommandLineFactory.load(); diff --git a/src60/system/win_strings.l b/src60/system/win_strings.l index bb4003d613..4035dcbc4f 100644 --- a/src60/system/win_strings.l +++ b/src60/system/win_strings.l @@ -1,2 +1,2 @@ -public const String newLineConstant +public const String NewLineConstant = $13$10; diff --git a/src60/system/winforms/win_app.l b/src60/system/winforms/win_app.l index 2ad00efc0f..ff9dc4d690 100644 --- a/src60/system/winforms/win_app.l +++ b/src60/system/winforms/win_app.l @@ -4,7 +4,7 @@ public sealed class SDIApplication { object _mainWindow; - internal constructor() + constructor new() { _mainWindow := forward MainWindow.new(); } @@ -74,4 +74,4 @@ public sealed class SDIApplication } } -public static SDIApplication program = new SDIApplication(); \ No newline at end of file +public static SDIApplication program = SDIApplication.new(); \ No newline at end of file diff --git a/tests60/sandbox/sandbox.l b/tests60/sandbox/sandbox.l index b85e1ea5a4..9ec6a551ac 100644 --- a/tests60/sandbox/sandbox.l +++ b/tests60/sandbox/sandbox.l @@ -1,37 +1,4 @@ -import system'threading; - -public abstract class BaseValue -{ -} - -singleton X -{ -// Task someMethodAsync1() -// { -// ^ new Task(/*console.writeLine("someMethodAsync1"); Thread.delay(1000); }*/); -// } - -// Task someMethodAsync2() -// { -// ^ new Task({ console.writeLine("someMethodAsync2"); Thread.delay(3000); }); -// -// } - -/* async Task test() - { - console.writeLine("Before"); - - $await Task.Run( { console.writeLine("someMethodAsync1"); Thread.delay(1000); }); - - console.writeLine("After"); - }*/ -} public program() { -// Task t := X.test(); - -// t.Result; - - console.readChar() -} +} \ No newline at end of file diff --git a/tests60/system_tests/basic.l b/tests60/system_tests/basic.l index 9622be4ed1..14558fcebd 100644 --- a/tests60/system_tests/basic.l +++ b/tests60/system_tests/basic.l @@ -568,7 +568,7 @@ public boxingTests() : testCase() console.write("."); // --- boxing / unboxing variable struct - BoxingStruct st; + BoxingStruct st := default; BoxingProber.set(st); st.test(3,4); console.write("."); @@ -2124,3 +2124,155 @@ public isNilOperatorTest() : testCase() Assert.ifFailed({ var a := nil; var b := nil; var r := a ?? b.test() }); console.write("."); } + +namespace IndexedTest +{ + A + { + indexed foo() + = "from A"; + + indexed foo(string s) + = "from A with " + s; + + indexed foo(int n) + = "from A with int"; + + indexed internal fooInternal(string s) + = "from A with hidden " + s; + } + + B : A + { + indexed foo() + = "from B"; + + indexed foo(string s) + = "from B with "+s; + + indexed internal fooInternal(string s) + = "from B with hidden " + s; + } + + C : A + { + indexed bar() + = "from C"; + } +} + +public indexedTests() : testCase() +{ + IndexedTest'A a := new IndexedTest'A(); + Assert.ifEqual(a.foo(), "from A"); + Assert.ifEqual(weak a.foo(), "from A"); + console.write("."); + + IndexedTest'A b := new IndexedTest'B(); + Assert.ifEqual(b.foo(), "from B"); + Assert.ifEqual(weak b.foo(), "from B"); + + IndexedTest'A c := new IndexedTest'C(); + Assert.ifEqual(c.foo(), "from A"); + Assert.ifEqual(weak c.foo(), "from A"); + console.write("."); + + Assert.ifEqual(a.foo("Hello"), "from A with Hello"); + Assert.ifEqual(weak a.foo("Hello2"), "from A with Hello2"); + Assert.ifEqual(b.foo("Hello"), "from B with Hello"); + Assert.ifEqual(weak b.foo("Hello"), "from B with Hello"); + Assert.ifEqual(c.foo("Hello2"), "from A with Hello2"); + Assert.ifEqual(weak c.foo("Hello2"), "from A with Hello2"); + console.write("."); + + Assert.ifEqual(a.fooInternal("Hello"), "from A with hidden Hello"); + Assert.ifEqual(b.fooInternal("Hello"), "from B with hidden Hello"); + Assert.ifEqual(c.fooInternal("Hello2"), "from A with hidden Hello2"); + + Assert.ifFailed({weak a.fooInternal("Hello")}); + Assert.ifFailed({weak b.fooInternal("Hello")}); + Assert.ifFailed({weak c.fooInternal("Hello")}); + console.write("."); + +} + +namespace sealedMethodDispatcherTest +{ + C; + + public closed A + { + sealed continueWith(C c) + { + } + } + + public sealed B : A + { + } +} + +public sealedMethodDispatcher() : testCase() +{ + sealedMethodDispatcherTest'B b := new sealedMethodDispatcherTest'B(); + var c := new sealedMethodDispatcherTest'C(); + + Assert.ifNotFailed({ weak b.continueWith(c); }); + console.write("."); +} + +public objectOpTests() : testCase() +{ + A a := new A(); + + string name := a.__getClassName(); + + Assert.ifEqual(name, "system_tests'$private'A"); + console.write("."); +} + +namespace variadicBoxingTestset +{ + A + { + field args; + + constructor load(params string[] args) + { + this args := args; + } + + int Length + = args.Length; + + validate(params string[] args) + { + for (int i := 0; i < args.Length; i++) { + Assert.ifEqual(this args[i], args[i]); + } + } + + static validate2(params string[] args) + { + string[] boxedArgs := args; + + Assert.ifEqual(boxedArgs.Length, args.Length); + + for (int i := 0; i < args.Length; i++) { + Assert.ifEqual(boxedArgs[i], args[i]); + } + } + } +} + +public variadicBoxingTest() : testCase() +{ + auto a := variadicBoxingTestset'A.load("a", "b", "c"); + + Assert.ifEqual(a.Length, 3); + a.validate("a", "b", "c"); + Console.write("."); + + variadicBoxingTestset'A.validate2("a", "b", "c"); + Console.write("."); +}