Skip to content

Prepare DtoCallFunction() for runtime function calls #1238

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

Merged
merged 1 commit into from
Feb 6, 2017

Conversation

kinke
Copy link
Member

@kinke kinke commented Dec 20, 2015

By also taking DValue* args, not just Expression*s.

@kinke
Copy link
Member Author

kinke commented Dec 20, 2015

A first step towards calling runtime functions with the DtoCallFunction() machinery. What's still missing:

  1. Right now, we only have a LL function for each runtime function. We'll need to keep the associated TypeFunction* around too in order to create the DValue* fnval argument for DtoCallFunction().
  2. Replace all direct LL function calls by DtoCallFunction() calls, using DValue* args instead of LL args etc.

@JohanEngelen
Copy link
Member

Nice that you are working on the follow-up to #1208 !
I was thinking about adding a map to gen/runtime.h from functionstringname -> (llvm::Function, TypeFunction).

TypeFunction *const tf = DtoTypeFunction(fnval);

const size_t numArguments = arguments ? arguments->dim : 0;
std::vector<DValue *> argvals(numArguments);
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps you can use llvm::SmallVector here (number of arguments is usually small I'd think).

@dnadlinger
Copy link
Member

Could you incorporate Johan's suggestions and rebase, please?

@kinke
Copy link
Member Author

kinke commented Jan 5, 2016

I'm not a huge fan of llvm::ArrayRef due its missing support for initializer lists in LLVM 3.5 (and 3.6?) and I doubt a llvm::SmallVector provides any measurable performance benefit over a single small heap allocation (size known a priori, elements are pointers only, each DValue arg allocated on the heap as well iirc), but I can still be persuaded. ;)

I still need to figure out how to structure the logging, as the args are currently evaluated outside the DtoCallFunction logger scope.

@JohanEngelen
Copy link
Member

Yeah, forget about my comments :)

@redstar
Copy link
Member

redstar commented Mar 22, 2016

Rebase on ltsmaster and merge?

@kinke
Copy link
Member Author

kinke commented Jan 22, 2017

Finally rebased incl. taking care of logging.

By also accepting DValue args, not just Expressions.
@kinke kinke merged commit 87bfcc7 into ldc-developers:master Feb 6, 2017
@kinke kinke deleted the tocall branch February 6, 2017 15:59
e-y-e pushed a commit to e-y-e/ldc that referenced this pull request Feb 6, 2017
…1238)

By also accepting DValue args, not just Expressions.
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