Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ORC] Add Value support for capturing runtime JITed code results in clang-repl. #145263

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

SahilPatidar
Copy link
Contributor

Adds a Value class to support capturing the results of JIT-compiled expressions in clang-repl. This allows runtime values to be stored and passed through the ORC executor.

Comment on lines +22 to +38
#define BUILTIN_TYPES \
X(bool, Bool) \
X(char, Char_S) \
X(int8_t, SChar) \
X(uint8_t, Char_U) \
X(uint8_t, UChar) \
X(int16_t, Short) \
X(uint16_t, UShort) \
X(int32_t, Int) \
X(uint32_t, UInt) \
X(int64_t, LongLong) \
X(uint64_t, ULongLong) \
// X(long, Long) \
// X(unsigned long, ULong) \
// X(float, Float) \
// X(double, Double) \
// X(long double, LongDouble)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the idea here to define as many types as possible while remaining agnostic to the major data models?

Should Value just work in terms of raw sizes / signedness ([u]int8, [u]int16, ..., [u]int64) and then the compiler can map those into whatever data model it's using?

(I'm imagining the case where clang-repl might be used to inject code into some tiny microcontroller where the data model might be incompatible with the above)

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’m using fixed-size types so they work across all platforms. In setValue, I cast long and long long to fixed sizes based on whether they’re 4 or 8 bytes—but I’m not sure that’ll work correctly on microcontrollers with different type sizes.

Comment on lines +143 to +144
if (!SPSArgList<SPSExecutorAddr>::serialize(OB, V.getOpaqueType()))
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we passing around references to an opaque type class here? This type would only exist in the controller, right? Not the executor?

Copy link
Contributor Author

@SahilPatidar SahilPatidar Jun 25, 2025

Choose a reason for hiding this comment

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

Yes, but usually the Value class just stores the type and raw data together, which is why we only keep the address — even though I was thinking of tracking the type info on the controller side.

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