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

implements {.compile.} #367

Closed
wants to merge 12 commits into from
Closed

implements {.compile.} #367

wants to merge 12 commits into from

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Jan 15, 2025

fixes #357

ref https://github.com/microsoft/mimalloc

  • Make hastur download mimalloc as part of the build process. Maybe depend on it via a git submodule.
  • Add .compile: "foo.c" to Nimony so that we can also depend on C code like mimalloc.
  • Make use of .compile in system.nim so we can use a decent memory allocator which offers allocatedSize() so that our new super efficient strings and seq can use it.

@ringabout ringabout changed the title implements {.compile implements {.compile.} Jan 15, 2025
@ringabout ringabout marked this pull request as ready for review January 16, 2025 13:56
@ringabout
Copy link
Member Author

ringabout commented Jan 16, 2025

{.compile.} is almost finished, but it requires

  • importc mangling support
  • currentSourcePath: so {.compile("$path", "-I$includedPath").} can get the source path for parameters at the compile time
  • semcheck for compile and handle path better exactly like the Nim compiler

@Araq
Copy link
Member

Araq commented Jan 16, 2025

Have you considered to make Nimony emit (compile "foobar.c") information to the generated index file. Then it would be precise for when x: {.compile ...} and it would not require this ugly Nifler addition. The dependency analyser might have trouble with that though... :-(

@@ -0,0 +1,8 @@
{.compile: "foo.c".}
{.compile("foo.c", "-fno-strict-aliasing")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{.compile("foo.c", "-fno-strict-aliasing")
{.compile("foo1.c", "-fno-strict-aliasing").}

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@ringabout
Copy link
Member Author

Succeeded by #383

@ringabout ringabout closed this Jan 18, 2025
@ringabout ringabout deleted the pr_compile_c branch January 18, 2025 10:37
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.

Implement .compile pragma
4 participants