Skip to content

Conversation

@ChingLongTin
Copy link

Call implementation will be after the algorithms for instrumenting functions are completed.

  1. allocating optionNme
    This changed some diff tests (OpenWildcard.mls, Imports.mls, ImportMLs.mls) that imported Option themselves.
    If I allocate optionNme after checking if stageCode is enabled, it fails to link to the file.
    Is there some way to avoid changing the diff tests, or is this fine?

  2. implementing I-Inst
    The current shape for Class C(n:s) includes the field names (n), but the field names are not available in Instantiation.
    The field names are used in sel. If the class is staged using I-Cls, then we can use the staged ClsLikeDefn to retrieve the symbol names, but when do we do when it isn't staged?

class A(a)
staged module B
  class C(a)
  fun f() = 
    new C(1) // ok, C is staged
    new A(1) // not ok, we don't know field names of A after instrumentation

ChingLongTin and others added 30 commits October 22, 2025 13:17
…ring

Add Block.mls into DiffMaker and prepare the function for lowering

Use older Import syntax for now
ChingLongTin and others added 14 commits December 18, 2025 19:05
after shape information is removed, the extra typechecking is no longer helpful
use no ident after match, like in Lowering.scala
the definitions should utilize CachedHash before getting merged
since the shape is not inferred, each branch can use the same x to compute its branch
@ChingLongTin ChingLongTin marked this pull request as ready for review December 23, 2025 06:36
@ChingLongTin ChingLongTin changed the title Instrumentation (without Call) Instrumentation into Block IR Dec 23, 2025
ChingLongTin and others added 5 commits December 23, 2025 20:40
def init(using State): Ctx = Ctx.empty.copy(env = Map(
"globalThis" -> globalThisSymbol,
"Term" -> termSymbol,
"Block" -> blockSymbol,
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, I don't think this should be here and neither should "Term". This is the context meant for the user. For internal uses, one should use an internal symbol (like runtimeSymbol), not a plain name. Cc @NeilKleistGao.

Copy link
Member

Choose a reason for hiding this comment

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

I think the block and the shape module would not be used explicitly by users, but users do need to write code like Term.codegen. if we remove it from the context, then users should import the term module explicitly.

Copy link
Contributor

Choose a reason for hiding this comment

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

If some functions like this should be accessible by users, they should be in the Predef. The Predef could either re-export Term (but it's a bit weird, since most things in it are not meant to be used directly by users) or define some submodule, such as module meta with { fun codegen... }.

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.

4 participants