Skip to content

Comments

No more cpp jit#1994

Merged
borisbat merged 7 commits intoGaijinEntertainment:masterfrom
aleksisch:no-more-cpp-jit
Dec 29, 2025
Merged

No more cpp jit#1994
borisbat merged 7 commits intoGaijinEntertainment:masterfrom
aleksisch:no-more-cpp-jit

Conversation

@aleksisch
Copy link
Contributor

No description provided.

@aleksisch aleksisch force-pushed the no-more-cpp-jit branch 3 times, most recently from 8f67890 to 7804942 Compare December 28, 2025 13:56
} else {
at_function_entry <| $() {
v_ptr = LLVMBuildAlloca(g_builder, vtype, "variable_{arg.name}")
LLVMBuildMemSet(g_builder, v_ptr, 0ul, uint64(vsize), uint(valign))
Copy link
Contributor Author

@aleksisch aleksisch Dec 28, 2025

Choose a reason for hiding this comment

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

@borisbat What do you think, should we init it here? We do so in AOT, but maybe we can add a check related to existance of finally block, since we need initialization apparently only in case:

def test() {
    if (true) {
        return;
    }
    let x = new B()
} finally {
    unsafe {
        delete x
    }
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

can you check if LLVM optimizes this out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried a bunch of examples, with O3, I couldn't find an example when this initialization is not optimized, moreover, LLVM optimizes even alloca call

@aleksisch aleksisch force-pushed the no-more-cpp-jit branch 5 times, most recently from 5bff890 to e82f22b Compare December 29, 2025 07:05
@aleksisch aleksisch changed the title [WIP] No more cpp jit No more cpp jit Dec 29, 2025
@aleksisch aleksisch force-pushed the no-more-cpp-jit branch 3 times, most recently from 1a3cbce to 4bc7481 Compare December 29, 2025 08:06
Code in inscope_return_inscope.das contained UB, code like:
```
[sideeffects]
def buggy(skip : bool) {
    var a = new Foo
    if (skip) {
        return
    }
    var b = new Foo
} finally {
    unsafe {
        delete a
        delete b
    }
}
```
Sometimes it crashed, because b is uninitialized and when delete
was called it was treated as initialized.

More specifically it crashed when `daScriptTest` was called with
all the JIT optimizations disabled (LLVM_ENABLE_OPT_PASS=false)
and daslang built in Release or RelWithDebInfo.
Now we can JIT for loops which iterates over strings.
We want to check whether function a jit function even
if JIT module is not available, same way we check is_jit_enabled.

Let's move is_jit_function to module_builtin_runtime.
We are no longer needed cpp module for JIT at all.
@aleksisch aleksisch force-pushed the no-more-cpp-jit branch 2 times, most recently from c697018 to 2b8064a Compare December 29, 2025 11:48
- Add missed delete
- Add nan check, since nan != nan
- Remove all JIT related stuff, it's useless with last JIT updates
UBSAN complains about values in test
type_constructors being out of range. This
test file was commented until we'll fix this
issue.
@borisbat borisbat merged commit 0ce38c4 into GaijinEntertainment:master Dec 29, 2025
21 checks passed
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.

2 participants