Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate ASTVisitor.visit for ExpressionNode #490

Merged

Conversation

WebFreak001
Copy link
Member

abstract classes should not have visitor functions, but rather only do dynamic dispatch. This becomes more important later with #409

@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #490 (0ed83f7) into master (2490a81) will decrease coverage by 0.01%.
The diff coverage is 92.50%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #490      +/-   ##
==========================================
- Coverage   83.49%   83.48%   -0.01%     
==========================================
  Files          11       11              
  Lines        8483     8484       +1     
==========================================
  Hits         7083     7083              
- Misses       1400     1401       +1     
Impacted Files Coverage Δ
src/dparse/ast.d 70.13% <50.00%> (-0.12%) ⬇️
src/dparse/astprinter.d 94.95% <94.73%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2490a81...0ed83f7. Read the comment docs.

Copy link

@vushu vushu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

abstract classes should not have visitor functions, but rather only do
dynamic dispatch. This becomes more important later with dlang-community#409
@github-actions
Copy link

github-actions bot commented Mar 24, 2023

✅ PR OK, no changes in deprecations or warnings

Total deprecations: 0

Total warnings: 0

Build statistics:

 ------ libdparse statistics ------
 
 statistics (-before, +after)
-library size=3432236 libdparse.a
+library size=3434196 libdparse.a
 rough build time=16s
 
 
 ------ DCD statistics ------
 
 statistics (-before, +after)
 client size=1055768 bin/dcd-client
 server size=3006064 bin/dcd-server
-rough build time=75s
+rough build time=74s
 
-DCD run_tests.sh 	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.80
-DCD run_tests.sh 	Maximum resident set size (kbytes): 12832
+DCD run_tests.sh 	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.82
+DCD run_tests.sh 	Maximum resident set size (kbytes): 9704
 
 short requests: (215x)
     min request time =     0.009ms
-    10th percentile  =     0.120ms
-    median time      =     0.421ms
-    90th percentile  =     0.763ms
-    max request time =     1.464ms
+    10th percentile  =     0.111ms
+    median time      =     0.430ms
+    90th percentile  =     0.717ms
+    max request time =     1.516ms
 
 
 top 5 GC sources in server:
 bytes allocated, allocations, type, function, file:line
         7554112	          81399	void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         7536640	            460	void[] std.array.Appender!(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;")[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         2277376	            278	void[] std.array.Appender!(char[][]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         1830176	          57193	std.array.Appender!(dsymbol.symbol.DSymbol*[]).Appender.Data std.array.Appender!(DSymbol*[]).Appender.this /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3452
-        1508352	            604	void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
+        1405952	            598	void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
Full build output
DUB version 1.31.1, built on Mar 12 2023
LDC - the LLVM D compiler (1.32.0):
  based on DMD v2.102.2 and LLVM 15.0.7
  built with LDC - the LLVM D compiler (1.32.0)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake-avx512
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    avr        - Atmel AVR Microcontroller
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    hexagon    - Hexagon
    lanai      - Lanai
    mips       - MIPS (32-bit big endian)
    mips64     - MIPS (64-bit big endian)
    mips64el   - MIPS (64-bit little endian)
    mipsel     - MIPS (32-bit little endian)
    msp430     - MSP430 [experimental]
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc32le    - PowerPC 32 LE
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
    riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    sparc      - Sparc
    sparcel    - Sparc LE
    sparcv9    - Sparc V9
    systemz    - SystemZ
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    ve         - VE
    wasm32     - WebAssembly 32-bit
    wasm64     - WebAssembly 64-bit
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64
    xcore      - XCore
   Upgrading project in /home/runner/work/libdparse/libdparse/
    Starting Performing "release" build using /opt/hostedtoolcache/dc/ldc2-1.32.0/x64/ldc2-1.32.0-linux-x86_64/bin/ldc2 for x86_64.
    Building libdparse 0.22.0+commit.3.g8b499e5: building configuration [library]
STAT:------ libdparse statistics ------
STAT:
STAT:statistics (-before, +after)
STAT:library size=3434196 libdparse.a
STAT:rough build time=16s
STAT:
STAT:
STAT:------ DCD statistics ------
STAT:
{
  "name": "dcd",
  "description": "The D Completion Daemon is an auto-complete program for the D programming language",
  "copyright": "Copyright © 2015-2020, Brian Schott",
  "authors": [
    "Brian Schott"
  ],
  "license": "GPL-3.0",
  "dependencies": {
    ":dsymbol": "*",
    "libdparse": {"path":".."},
    ":common": "*",
    "emsi_containers": "~>0.9.0"
  },
  "subPackages": ["dsymbol", "common"],
  "versions": ["built_with_dub"],
  "configurations": [
    {
      "name": "library",
      "targetType": "library",
      "excludedSourceFiles": [
        "src/dcd/client/*",
        "src/dcd/server/main.d"
      ]
    },
    {
      "name": "client",
      "targetType": "executable",
      "targetPath": "bin/",
      "targetName": "dcd-client",
      "excludedSourceFiles": [
        "src/dcd/server/*"
      ]
    },
    {
      "name": "server",
      "targetType": "executable",
      "targetPath": "bin/",
      "targetName": "dcd-server",
      "excludedSourceFiles": [
        "src/dcd/client/*"
      ]
    }
  ]
}
{
	"fileVersion": 1,
	"versions": {
		"dsymbol": "0.14.1",
		"emsi_containers": "0.9.0",
		"libdparse": {"path":".."},
		"msgpack-d": "1.0.4",
		"stdx-allocator": "2.77.5"
	}
}
STAT:statistics (-before, +after)
STAT:client size=1055768 bin/dcd-client
STAT:server size=3006064 bin/dcd-server
STAT:rough build time=74s
STAT:
�[33munix:tc001:�[0m ... �[32mPass�[0m
�[33munix:tc002:�[0m ... �[32mPass�[0m
�[33munix:tc003:�[0m ... �[32mPass�[0m
�[33munix:tc004:�[0m ... �[32mPass�[0m
�[33munix:tc005:�[0m ... �[32mPass�[0m
�[33munix:tc006:�[0m ... �[32mPass�[0m
�[33munix:tc007:�[0m ... �[32mPass�[0m
�[33munix:tc008:�[0m ... �[32mPass�[0m
�[33munix:tc009:�[0m ... �[32mPass�[0m
�[33munix:tc010:�[0m ... �[32mPass�[0m
�[33munix:tc011:�[0m ... �[32mPass�[0m
�[33munix:tc012:�[0m ... �[32mPass�[0m
�[33munix:tc013:�[0m ... �[32mPass�[0m
�[33munix:tc014:�[0m ... �[32mPass�[0m
�[33munix:tc015:�[0m ... �[32mPass�[0m
�[33munix:tc016:�[0m ... �[32mPass�[0m
�[33munix:tc017:�[0m ... �[32mPass�[0m
�[33munix:tc018:�[0m ... �[32mPass�[0m
�[33munix:tc019:�[0m ... �[32mPass�[0m
�[33munix:tc020:�[0m ... �[32mPass�[0m
�[33munix:tc021:�[0m ... �[32mPass�[0m
�[33munix:tc022:�[0m ... �[32mPass�[0m
�[33munix:tc023:�[0m ... �[32mPass�[0m
�[33munix:tc024:�[0m ... �[32mPass�[0m
�[33munix:tc025:�[0m ... �[32mPass�[0m
�[33munix:tc026:�[0m ... �[32mPass�[0m
�[33munix:tc027:�[0m ... �[32mPass�[0m
�[33munix:tc028:�[0m ... �[32mPass�[0m
�[33munix:tc029:�[0m ... �[32mPass�[0m
�[33munix:tc030:�[0m ... �[32mPass�[0m
�[33munix:tc031:�[0m ... �[32mPass�[0m
�[33munix:tc032:�[0m ... �[32mPass�[0m
�[33munix:tc033:�[0m ... �[32mPass�[0m
�[33munix:tc034:�[0m ... �[32mPass�[0m
�[33munix:tc035:�[0m ... �[32mPass�[0m
�[33munix:tc036:�[0m ... �[32mPass�[0m
�[33munix:tc037:�[0m ... �[32mPass�[0m
�[33munix:tc038:�[0m ... �[32mPass�[0m
�[33munix:tc039:�[0m ... �[32mPass�[0m
�[33munix:tc040:�[0m ... �[32mPass�[0m
�[33munix:tc041:�[0m ... �[32mPass�[0m
�[33munix:tc042:�[0m ... �[32mPass�[0m
�[33munix:tc043:�[0m ... �[32mPass�[0m
�[33munix:tc044:�[0m ... �[32mPass�[0m
�[33munix:tc045:�[0m ... �[32mPass�[0m
�[33munix:tc046:�[0m ... �[32mPass�[0m
�[33munix:tc047:�[0m ... �[32mPass�[0m
�[33munix:tc048:�[0m ... �[32mPass�[0m
�[33munix:tc049:�[0m ... �[32mPass�[0m
�[33munix:tc050:�[0m ... �[32mPass�[0m
�[33munix:tc051:�[0m ... �[32mPass�[0m
�[33munix:tc052:�[0m ... �[32mPass�[0m
�[33munix:tc053:�[0m ... �[32mPass�[0m
�[33munix:tc054:�[0m ... �[32mPass�[0m
�[33munix:tc055:�[0m ... �[32mPass�[0m
�[33munix:tc056:�[0m ... �[32mPass�[0m
�[33munix:tc057:�[0m ... �[32mPass�[0m
�[33munix:tc058:�[0m ... �[32mPass�[0m
�[33munix:tc059:�[0m ... �[32mPass�[0m
�[33munix:tc060:�[0m ... �[32mPass�[0m
�[33munix:tc061:�[0m ... �[32mPass�[0m
�[33munix:tc062:�[0m ... �[32mPass�[0m
�[33munix:tc620:�[0m ... �[32mPass�[0m
�[33munix:tc_access_modifiers:�[0m ... �[32mPass�[0m
�[33munix:tc_accesschain_type:�[0m ... �[32mPass�[0m
�[33munix:tc_anon_class:�[0m ... �[32mPass�[0m
�[33munix:tc_anon_struct:�[0m ... �[32mPass�[0m
�[33munix:tc_bang_op_or_template:�[0m ... �[32mPass�[0m
�[33munix:tc_base_template_type:�[0m ... �[32mPass�[0m
�[33munix:tc_body_var:�[0m ... �[32mPass�[0m
�[33munix:tc_calltip_in_func:�[0m ... �[32mPass�[0m
�[33munix:tc_char_dot:�[0m ... �[32mPass�[0m
�[33munix:tc_complete_kw:�[0m ... �[32mPass�[0m
�[33munix:tc_currmod_fqn:�[0m ... �[32mPass�[0m
�[33munix:tc_ditto_scopes:�[0m ... �[32mPass�[0m
�[33munix:tc_empty_module:�[0m ... �[32mPass�[0m
00000�[33munix:tc_empty_requests:�[0m ... �[32mPass�[0m
�[33munix:tc_erroneous_body_content:�[0m ... �[32mPass�[0m
�[33munix:tc_extended_ditto:�[0m ... �[32mPass�[0m
�[33munix:tc_extended_types:�[0m ... �[32mPass�[0m
�[33munix:tc_if_auto_array:�[0m ... �[32mPass�[0m
�[33munix:tc_if_var:�[0m ... �[32mPass�[0m
�[33munix:tc_import_symbol_list:�[0m ... �[32mPass�[0m
�[33munix:tc_incomplete_switch:�[0m ... �[32mPass�[0m
�[33munix:tc_issue558:�[0m ... �[32mPass�[0m
�[33munix:tc_locate_ufcs_function:�[0m ... �[32mPass�[0m
�[33munix:tc_middle_of_utf:�[0m ... �[32mPass�[0m
�[33munix:tc_module_scope_op:�[0m ... �[32mPass�[0m
�[33munix:tc_named_mixin:�[0m ... �[32mPass�[0m
�[33munix:tc_opaque_structs:�[0m ... �[32mPass�[0m
�[33munix:tc_pointer_type_printing:�[0m ... �[32mPass�[0m
�[33munix:tc_pointers:�[0m ... �[32mPass�[0m
�[33munix:tc_recursive_public_import:�[0m ... �[32mPass�[0m
�[33munix:tc_rm_import:�[0m ... �[32mPass�[0m
�[33munix:tc_scope_mess:�[0m ... �[32mPass�[0m
�[33munix:tc_selective_import_list:�[0m ... �[32mPass�[0m
�[33munix:tc_super_scope:�[0m ... �[32mPass�[0m
�[33munix:tc_template_param_props:�[0m ... �[32mPass�[0m
�[33munix:tc_traits:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_alias_this_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_array_type_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_calltip_in_func:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_fundamental_types_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_pointer_type_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_struct_completion:�[0m ... �[32mPass�[0m
STAT:DCD run_tests.sh 	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.82
STAT:DCD run_tests.sh 	Maximum resident set size (kbytes): 9704
STAT:
STAT:short requests: (215x)
STAT:    min request time =     0.009ms
STAT:    10th percentile  =     0.111ms
STAT:    median time      =     0.430ms
STAT:    90th percentile  =     0.717ms
STAT:    max request time =     1.516ms
STAT:
STAT:
�[33munix:tc001:�[0m ... �[32mPass�[0m
�[33munix:tc002:�[0m ... �[32mPass�[0m
�[33munix:tc003:�[0m ... �[32mPass�[0m
�[33munix:tc004:�[0m ... �[32mPass�[0m
�[33munix:tc005:�[0m ... �[32mPass�[0m
�[33munix:tc006:�[0m ... �[32mPass�[0m
�[33munix:tc007:�[0m ... �[32mPass�[0m
�[33munix:tc008:�[0m ... �[32mPass�[0m
�[33munix:tc009:�[0m ... �[32mPass�[0m
�[33munix:tc010:�[0m ... �[32mPass�[0m
�[33munix:tc011:�[0m ... �[32mPass�[0m
�[33munix:tc012:�[0m ... �[32mPass�[0m
�[33munix:tc013:�[0m ... �[32mPass�[0m
�[33munix:tc014:�[0m ... �[32mPass�[0m
�[33munix:tc015:�[0m ... �[32mPass�[0m
�[33munix:tc016:�[0m ... �[32mPass�[0m
�[33munix:tc017:�[0m ... �[32mPass�[0m
�[33munix:tc018:�[0m ... �[32mPass�[0m
�[33munix:tc019:�[0m ... �[32mPass�[0m
�[33munix:tc020:�[0m ... �[32mPass�[0m
�[33munix:tc021:�[0m ... �[32mPass�[0m
�[33munix:tc022:�[0m ... �[32mPass�[0m
�[33munix:tc023:�[0m ... �[32mPass�[0m
�[33munix:tc024:�[0m ... �[32mPass�[0m
�[33munix:tc025:�[0m ... �[32mPass�[0m
�[33munix:tc026:�[0m ... �[32mPass�[0m
�[33munix:tc027:�[0m ... �[32mPass�[0m
�[33munix:tc028:�[0m ... �[32mPass�[0m
�[33munix:tc029:�[0m ... �[32mPass�[0m
�[33munix:tc030:�[0m ... �[32mPass�[0m
�[33munix:tc031:�[0m ... �[32mPass�[0m
�[33munix:tc032:�[0m ... �[32mPass�[0m
�[33munix:tc033:�[0m ... �[32mPass�[0m
�[33munix:tc034:�[0m ... �[32mPass�[0m
�[33munix:tc035:�[0m ... �[32mPass�[0m
�[33munix:tc036:�[0m ... �[32mPass�[0m
�[33munix:tc037:�[0m ... �[32mPass�[0m
�[33munix:tc038:�[0m ... �[32mPass�[0m
�[33munix:tc039:�[0m ... �[32mPass�[0m
�[33munix:tc040:�[0m ... �[32mPass�[0m
�[33munix:tc041:�[0m ... �[32mPass�[0m
�[33munix:tc042:�[0m ... �[32mPass�[0m
�[33munix:tc043:�[0m ... �[32mPass�[0m
�[33munix:tc044:�[0m ... �[32mPass�[0m
�[33munix:tc045:�[0m ... �[32mPass�[0m
�[33munix:tc046:�[0m ... �[32mPass�[0m
�[33munix:tc047:�[0m ... �[32mPass�[0m
�[33munix:tc048:�[0m ... �[32mPass�[0m
�[33munix:tc049:�[0m ... �[32mPass�[0m
�[33munix:tc050:�[0m ... �[32mPass�[0m
�[33munix:tc051:�[0m ... �[32mPass�[0m
�[33munix:tc052:�[0m ... �[32mPass�[0m
�[33munix:tc053:�[0m ... �[32mPass�[0m
�[33munix:tc054:�[0m ... �[32mPass�[0m
�[33munix:tc055:�[0m ... �[32mPass�[0m
�[33munix:tc056:�[0m ... �[32mPass�[0m
�[33munix:tc057:�[0m ... �[32mPass�[0m
�[33munix:tc058:�[0m ... �[32mPass�[0m
�[33munix:tc059:�[0m ... �[32mPass�[0m
�[33munix:tc060:�[0m ... �[32mPass�[0m
�[33munix:tc061:�[0m ... �[32mPass�[0m
�[33munix:tc062:�[0m ... �[32mPass�[0m
�[33munix:tc620:�[0m ... �[32mPass�[0m
�[33munix:tc_access_modifiers:�[0m ... �[32mPass�[0m
�[33munix:tc_accesschain_type:�[0m ... �[32mPass�[0m
�[33munix:tc_anon_class:�[0m ... �[32mPass�[0m
�[33munix:tc_anon_struct:�[0m ... �[32mPass�[0m
�[33munix:tc_bang_op_or_template:�[0m ... �[32mPass�[0m
�[33munix:tc_base_template_type:�[0m ... �[32mPass�[0m
�[33munix:tc_body_var:�[0m ... �[32mPass�[0m
�[33munix:tc_calltip_in_func:�[0m ... �[32mPass�[0m
�[33munix:tc_char_dot:�[0m ... �[32mPass�[0m
�[33munix:tc_complete_kw:�[0m ... �[32mPass�[0m
�[33munix:tc_currmod_fqn:�[0m ... �[32mPass�[0m
�[33munix:tc_ditto_scopes:�[0m ... �[32mPass�[0m
�[33munix:tc_empty_module:�[0m ... �[32mPass�[0m
00000�[33munix:tc_empty_requests:�[0m ... �[32mPass�[0m
�[33munix:tc_erroneous_body_content:�[0m ... �[32mPass�[0m
�[33munix:tc_extended_ditto:�[0m ... �[32mPass�[0m
�[33munix:tc_extended_types:�[0m ... �[32mPass�[0m
�[33munix:tc_if_auto_array:�[0m ... �[32mPass�[0m
�[33munix:tc_if_var:�[0m ... �[32mPass�[0m
�[33munix:tc_import_symbol_list:�[0m ... �[32mPass�[0m
�[33munix:tc_incomplete_switch:�[0m ... �[32mPass�[0m
�[33munix:tc_issue558:�[0m ... �[32mPass�[0m
�[33munix:tc_locate_ufcs_function:�[0m ... �[32mPass�[0m
�[33munix:tc_middle_of_utf:�[0m ... �[32mPass�[0m
�[33munix:tc_module_scope_op:�[0m ... �[32mPass�[0m
�[33munix:tc_named_mixin:�[0m ... �[32mPass�[0m
�[33munix:tc_opaque_structs:�[0m ... �[32mPass�[0m
�[33munix:tc_pointer_type_printing:�[0m ... �[32mPass�[0m
�[33munix:tc_pointers:�[0m ... �[32mPass�[0m
�[33munix:tc_recursive_public_import:�[0m ... �[32mPass�[0m
�[33munix:tc_rm_import:�[0m ... �[32mPass�[0m
�[33munix:tc_scope_mess:�[0m ... �[32mPass�[0m
�[33munix:tc_selective_import_list:�[0m ... �[32mPass�[0m
�[33munix:tc_super_scope:�[0m ... �[32mPass�[0m
�[33munix:tc_template_param_props:�[0m ... �[32mPass�[0m
�[33munix:tc_traits:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_alias_this_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_array_type_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_calltip_in_func:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_fundamental_types_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_pointer_type_completion:�[0m ... �[32mPass�[0m
�[33munix:tc_ufcs_struct_completion:�[0m ... �[32mPass�[0m
STAT:top 5 GC sources in server:
STAT:bytes allocated, allocations, type, function, file:line
STAT:        7554112	          81399	void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
STAT:        7536640	            460	void[] std.array.Appender!(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;")[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
STAT:        2277376	            278	void[] std.array.Appender!(char[][]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
STAT:        1830176	          57193	std.array.Appender!(dsymbol.symbol.DSymbol*[]).Appender.Data std.array.Appender!(DSymbol*[]).Appender.this /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3452
STAT:        1405952	            598	void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577

@WebFreak001
Copy link
Member Author

the "Maximum resident set size" seems unlikely to have changed drastically with this PR (in fact, only stack usage might have slightly increased through the introduced additional function call for compatibility)

We probably need to investigate about a better approach for tracking peak memory usage in DCD. Maybe using valgrind massif?

@WebFreak001
Copy link
Member Author

merging with reduced coverage since the missing coverage is in a deprecated function that will be removed eventually. (and is still covered by DCD tests)

@WebFreak001 WebFreak001 merged commit 776ca6b into dlang-community:master Mar 24, 2023
@WebFreak001 WebFreak001 deleted the explicit-dynamicdispatch branch March 24, 2023 21:34
*/
void dynamicDispatch(const ExpressionNode n)
{
switch (typeMap.get(typeid(n), 0))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following casts are not good as they could. There should be a bit cast based on the case:

case 1: visit(*cast(AddExpression*) &n); break;
/*etc*/
case 48: visit(*cast(XorExpression*) &n); break;

So far there are still dynamic casts, i.e calls to runtime _d_obj_cast, although those calls always succeed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think using bitcasts for class inheritance is safe, since the cast manipulates the pointer value, e.g.

Casting a class object to an interface consists of adding the offset of the interface's corresponding vptr to the address of the base of the object. Casting an interface ptr back to the class type it came from involves getting the correct offset to subtract from it from the object.Interface entry at vtbl[0]. Adjustor thunks are created and pointers to them stored in the method entries in the vtbl[] in order to set the this pointer to the start of the object instance corresponding to the implementing method.

Copy link

@ghost ghost May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No interface involved here. this is still the same, I mean interpreted as opaque pointers for example, in both cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's safe to do a bitcast, I trust the compiler to do it here (possibly only with optimization enabled) instead. I don't want to rely on the ABI internals for this

Copy link

@ghost ghost May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler can't do it for you here as obviously the type of the parameter is of a base node. So to conclude, I won't insist more but at least you are aware of the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants