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

December 2024 fixes #503

Merged
merged 14 commits into from
Dec 13, 2024
Merged

December 2024 fixes #503

merged 14 commits into from
Dec 13, 2024

Conversation

SuperFola
Copy link
Member

@SuperFola SuperFola commented Dec 11, 2024

Description

  • better handling of import lists, nearing a final version of the new import system and name resolution
  • string:find builtin can take an additional optional startIndex parameter
  • adding string:setAt to update a string and get a modified copy back, akin to list:setAt
  • adding @= and @@= to update list/strings in place (@= is 1D, @@= is 2D)
  • finally fixing the parser code that assigned row & cols, was 1 or 2 char off to the right ; error underlining is nearly perfect now! (need to fix underlining of macros when they fail)
  • increment & decrement super instructions now work on (+ symbol N) / (+ N symbol) / (- symbol N), with N between 0 and 4095 (included)
  • update the AST optimizer, closes Rewrite optimizer to have room for other optimizations #251
  • name resolution fixes regarding hidden symbols (a namespace that has symbols and is glob or with prefix should not hide symbols)

Checklist

  • I have read the Contributor guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation if needed
  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

Copy link

github-actions bot commented Dec 11, 2024

Static analysis report

Lizard report

Listing only functions with cyclomatic complexity >= 15 or NLOC >= 100 or parameters >= 6.

Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/VM/VM.cpp 320:1385 Ark::VM::safeRun 3 875 184
src/arkreactor/Compiler/Compiler.cpp 433:600 Ark::internal::Compiler::handleCalls 5 136 40
src/arkscript/JsonCompiler.cpp 27:257 JsonCompiler::_compile 1 198 37
src/arkscript/main.cpp 17:336 main 2 276 30
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 160:258 Ark::internal::NameResolutionPass::visitKeyword 3 83 30
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 120:149 Ark::internal::IROptimizer::compactEntities 3 20 28
src/arkreactor/Compiler/Compiler.cpp 120:222 Ark::internal::Compiler::compileExpression 5 84 27
src/arkreactor/Compiler/AST/Node.cpp 233:306 Ark::internal::Node::debugPrint 1 64 24
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 55:158 Ark::internal::NameResolutionPass::visit 2 84 23
src/arkreactor/Compiler/Compiler.cpp 242:299 Ark::internal::Compiler::compileListInstruction 4 47 22
src/arkreactor/Compiler/AST/Optimizer.cpp 33:83 Ark::internal::Optimizer::countAndPruneDeadCode 1 42 20
src/arkreactor/Compiler/AST/Node.cpp 160:231 Ark::internal::Node::repr 0 59 18
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 87:118 Ark::internal::IROptimizer::compactEntities 2 18 16
src/arkreactor/Compiler/NameResolution/StaticScope.cpp 67:102 Ark::internal::NamespaceScope::get 2 27 15
Report about files you didn't modify in this PR
Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/Compiler/Macros/Processor.cpp 219:548 Ark::internal::MacroProcessor::evaluate 3 308 122
src/arkreactor/Compiler/BytecodeReader.cpp 197:447 Ark::BytecodeReader::display 4 215 76
src/arkscript/REPL/Repl.cpp 17:229 Ark::Repl::Repl 1 180 35
include/Ark/Compiler/AST/Parser.hpp 105:194 Ark::internal::ARK_APIParser::string 0 87 32
src/arkreactor/Compiler/Macros/Processor.cpp 100:183 Ark::internal::MacroProcessor::processNode 3 61 26
src/arkreactor/Compiler/AST/Parser.cpp 272:406 Ark::internal::Parser::import_ 0 108 23
include/utf8.hpp 138:184 utf8::isValid 1 44 21
src/arkreactor/VM/Value.cpp 67:125 Ark::Value::toString 1 46 17
src/arkreactor/Compiler/Macros/Executors/Function.cpp 16:88 Ark::internal::FunctionExecutor::applyMacro 2 55 17
include/Ark/Compiler/AST/Predicates.hpp 132:156 Ark::internal::IsSymbol::operator ( ) 1 24 16
src/arkscript/Formatter.cpp 168:224 Formatter::format 3 53 16
src/arkreactor/Compiler/Macros/Processor.cpp 630:669 Ark::internal::MacroProcessor::isConstEval 1 35 16
src/arkreactor/TypeChecker.cpp 28:85 Ark::types::displayContract 2 51 15
src/arkreactor/Exceptions.cpp 86:130 Ark::Diagnostics::makeContext 6 35 15
src/arkreactor/Exceptions.cpp 133:146 Ark::Diagnostics::helper 9 12 4
include/Ark/Exceptions.hpp 92:101 Ark::CodeError::CodeError 6 10 1

CppCheck report

Filename Line Type Description
src/arkreactor/Compiler/AST/Node.cpp 33 performance Function parameter 'namespace_' should be passed by const reference.
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 11 style struct member 'EntityWithOffset::offset' is never used.
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 141 style Consider using std::find_if algorithm instead of a raw loop.
src/arkreactor/VM/VM.cpp 1452 error Internal error. AST cyclic dependency.
src/arkreactor/VM/VM.cpp 358 error syntax error
src/arkscript/JsonCompiler.cpp 177 style Consider using std::accumulate algorithm instead of a raw loop.
src/arkscript/JsonCompiler.cpp 184 style Consider using std::transform algorithm instead of a raw loop.
src/arkscript/main.cpp 84 information Unmatched suppression: constStatement
Report files about files you didn't modify in this PR
Filename Line Type Description
src/arkreactor/Builtins/IO.cpp 24 style Parameter 'n' can be declared with const
src/arkreactor/Builtins/IO.cpp 43 style Parameter 'n' can be declared with const
src/arkreactor/Compiler/AST/Parser.cpp 398 error Uninitialized variable: import_data.is_glob
src/arkreactor/Compiler/BytecodeReader.cpp 332 style struct member 'Arg::arg' is never used.
src/arkreactor/Compiler/Macros/Processor.cpp 67 warning Assert statement calls a function which may have desired side effects: 'list'.
include/Ark/Compiler/NameResolution/StaticScope.hpp 137 style Consider using std::any_of algorithm instead of a raw loop.
src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp 57 style Consider using std::any_of algorithm instead of a raw loop.
src/arkreactor/VM/Scope.cpp 51 style Variable 'id' is not assigned a value.
src/arkreactor/VM/Scope.cpp 61 style Variable 'id' is not assigned a value.
src/arkreactor/VM/Scope.cpp 71 style Variable 'id' is not assigned a value.
src/arkreactor/VM/Value/Closure.cpp 21 style Parameter 'vm' can be declared with const
src/arkreactor/VM/Value/Closure.cpp 25 style Consider using std::any_of algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 24 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 26 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 28 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 30 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 36 style Consider using std::transform algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 38 style Consider using std::transform algorithm instead of a raw loop.
src/arkscript/REPL/Repl.cpp 47 style Consider using std::transform algorithm instead of a raw loop.

@coveralls
Copy link

coveralls commented Dec 11, 2024

Coverage Status

coverage: 79.237% (+1.9%) from 77.378%
when pulling 07e6b29 on december-2024-fixes
into db22968 on dev.

Copy link

github-actions bot commented Dec 11, 2024

Fuzzing report

/usr/local/bin/afl-whatsup status check tool for afl-fuzz by Michal Zalewski

Summary stats

    Fuzzers alive : 0
   Dead or remote : 1 (included in stats)
   Total run time : 5 minutes, 0 seconds
      Total execs : 38 thousands
 Cumulative speed : 129 execs/sec
    Pending items : 151 faves, 999 total
 Coverage reached : 10.31%
    Crashes saved : 0
      Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 36862 tuples (map size 192119, highest value 255, total values 314994790) in '/dev/null'.
[+] A coverage of 36862 edges were achieved out of 192128 existing (19.19%) with 1011 input files.

…ack of multiple mods (eg glob+symbols, symbols+prefix, all three at once), which can happen when a file is imported multiple times in a project
…n compiler to accept (if cond then) and not just (if cond then else)
@SuperFola SuperFola merged commit 798a164 into dev Dec 13, 2024
26 checks passed
@SuperFola SuperFola deleted the december-2024-fixes branch December 13, 2024 17:39
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.

Rewrite optimizer to have room for other optimizations
2 participants