Skip to content

Conversation

@mohanson
Copy link
Collaborator

No description provided.

@mohanson mohanson requested a review from Copilot September 12, 2025 05:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes debug logging in the PyWasm WebAssembly runtime by making the debug logging more explicit and streamlined. The changes focus on improving log clarity and reducing verbosity while maintaining essential debugging information.

  • Improved debug log condition to be more explicit (lvl > 0 instead of lvl)
  • Enhanced log formatting by adding 'pywasm:' prefix to all log messages
  • Streamlined section parsing debug logs by removing redundant section headers and loop indices
  • Reduced disassembly verbosity and commented out verbose call logging

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pywasm/log.py Enhanced debug logging condition and added pywasm prefix to log messages
pywasm/core.py Streamlined debug logging in WASM module parsing and runtime execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

func[i].expr = desc.expr
pywasm.log.debugln(' ', i, desc)
desc.expr.into_disasm(8)
pywasm.log.debugln('section code', desc)
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

[nitpick] The disassembly indentation level has been reduced from 8 to 4, but there's no documentation explaining why this specific value was chosen or what the parameter represents. Consider adding a comment to clarify the purpose of this magic number.

Suggested change
pywasm.log.debugln('section code', desc)
pywasm.log.debugln('section code', desc)
# Indent disassembly output by 4 spaces for readability; 4 is chosen to align with other section formatting.

Copilot uses AI. Check for mistakes.
pywasm/core.py Outdated
args = [self.stack.value.pop() for _ in range(len(func.type.args))][::-1]
nret = len(func.type.rets)
pywasm.log.debugln('call', func, args)
# pywasm.log.debugln('call', func, args)
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Instead of commenting out this debug log, consider using a different log level or a conditional check. Commented-out code should generally be removed unless there's a specific reason to keep it for future debugging.

Suggested change
# pywasm.log.debugln('call', func, args)
pywasm.log.debugln('call', func, args)

Copilot uses AI. Check for mistakes.
@mohanson mohanson merged commit 8cc535b into master Sep 12, 2025
6 checks passed
@mohanson mohanson deleted the update branch September 12, 2025 06:15
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