Skip to content

Swap push order of arguments #540

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

Merged
merged 6 commits into from
Jun 2, 2025
Merged

Swap push order of arguments #540

merged 6 commits into from
Jun 2, 2025

Conversation

SuperFola
Copy link
Member

@SuperFola SuperFola commented May 30, 2025

Description

Closes # (issue)

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

… explicitely

Thanks to this new instruction, the stack swapping is simpler. The goal is
to be able to remove the stack swapping later on, to avoid unnecessary
operations.
Copy link

github-actions bot commented May 30, 2025

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 449:1872 Ark::VM::safeRun 3 1191 244
src/arkreactor/Exceptions.cpp 87:297 Ark::Diagnostics::makeContext 9 152 61
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 522:678 Ark::internal::ASTLowerer::handleCalls 5 123 38
src/arkscript/main.cpp 23:352 main 2 284 31
src/arkreactor/Compiler/AST/Node.cpp 171:269 Ark::internal::Node::repr 0 84 28
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 138:242 Ark::internal::ASTLowerer::compileExpression 5 86 27
src/arkreactor/Compiler/AST/Node.cpp 271:344 Ark::internal::Node::debugPrint 1 64 24
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 268:326 Ark::internal::ASTLowerer::compileListInstruction 4 48 22
src/arkreactor/VM/VM.cpp 1984:2093 Ark::VM::backtrace 3 94 22
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 78:94 Ark::internal::ASTLowerer::nodeProducesOutput 1 13 15
src/arkreactor/Exceptions.cpp 299:310 Ark::Diagnostics::helper 9 11 2
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 239:617 Ark::internal::MacroProcessor::evaluate 3 355 125
src/arkreactor/Compiler/BytecodeReader.cpp 274:557 Ark::BytecodeReader::display 4 241 95
src/arkscript/JsonCompiler.cpp 27:260 JsonCompiler::_compile 1 200 36
include/Ark/Compiler/AST/Parser.hpp 107:196 Ark::internal::ARK_APIParser::string 0 87 32
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 162:273 Ark::internal::NameResolutionPass::visitKeyword 3 93 32
src/arkreactor/Compiler/Macros/Processor.cpp 102:185 Ark::internal::MacroProcessor::processNode 3 61 27
src/arkreactor/TypeChecker.cpp 110:194 Ark::types::generateError 5 72 24
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 54:160 Ark::internal::NameResolutionPass::visit 2 87 23
src/arkreactor/Compiler/AST/Parser.cpp 292:427 Ark::internal::Parser::import_ 0 109 23
include/utf8.hpp 138:184 utf8::isValid 1 44 21
src/arkreactor/Compiler/AST/Optimizer.cpp 33:83 Ark::internal::Optimizer::countAndPruneDeadCode 1 42 20
src/arkreactor/TypeChecker.cpp 28:108 Ark::types::displayContract 4 70 19
src/arkscript/REPL/Utils.cpp 52:184 Ark::internal::getColorPerKeyword 0 110 19
src/arkreactor/Compiler/NameResolution/StaticScope.cpp 68:109 Ark::internal::NamespaceScope::get 2 32 18
src/arkreactor/VM/Value.cpp 67:127 Ark::Value::toString 1 48 18
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/arkreactor/Compiler/Macros/Processor.cpp 699:738 Ark::internal::MacroProcessor::isConstEval 1 35 16
src/arkscript/Formatter.cpp 168:224 Formatter::format 3 53 16
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 12:180 Ark::internal::IROptimizer::IROptimizer 1 145 4

CppCheck report

Report files about files you didn't modify in this PR
Filename Line Type Description
src/arkreactor/Compiler/BytecodeReader.cpp 440 style struct member 'Arg::kind' is never used.
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 142 style Consider using std::find_if algorithm instead of a raw loop.

Copy link

github-actions bot commented May 30, 2025

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 : 152 faves, 1172 total
 Coverage reached : 12.68%
    Crashes saved : 0
      Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 47085 tuples (map size 213728, highest value 255, total values 409270264) in '/dev/null'.
[+] A coverage of 47085 edges were achieved out of 213760 existing (22.03%) with 1183 input files.

@SuperFola SuperFola force-pushed the feat/swap_args_push_order branch from 3f981be to 84e4061 Compare June 2, 2025 16:51
Copy link

codspeed-hq bot commented Jun 2, 2025

CodSpeed Performance Report

Merging #540 will improve performances by 11.12%

Comparing feat/swap_args_push_order (e7fcc59) with dev (259442d)

Summary

⚡ 1 improvements
✅ 13 untouched benchmarks
⁉️ 1 (👁 1) dropped benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
create_list 7.5 ms 6.7 ms +11.12%
👁 man_or_boy 534.9 µs N/A N/A

SuperFola added 2 commits June 2, 2025 19:06
…function calls

Also fix tests and use a reverse push order for arguments, since the other way around can
cause problems when we push references and swap arguments around.
@SuperFola SuperFola force-pushed the feat/swap_args_push_order branch from 84e4061 to 9f2fca8 Compare June 2, 2025 17:06
SuperFola added 3 commits June 2, 2025 19:08
… happen, leading to a crash while reporting an error, because the start index was after the end of the line
… happen if an invalid node is found and is on more than one line
@SuperFola SuperFola merged commit 58a637f into dev Jun 2, 2025
23 checks passed
@SuperFola SuperFola deleted the feat/swap_args_push_order branch June 2, 2025 18:01
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.

1 participant