-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
juliac: log entrypoints and nonstandard typedefs #59108
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
Open
timholy
wants to merge
31
commits into
master
Choose a base branch
from
teh/juliac_headerlogs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ebb3ded
juliac: log entrypoints and nonstandard typedefs
timholy 1099753
minor Makefile improvements
timholy e90786b
Nicer printing
timholy ce0f007
Use IdSet instead of Union
timholy 334f613
Try using the library
timholy 612350a
Remove Array from C-friendly types
timholy c2dffaf
Get the shared library working
timholy ff8931c
Clean up after trimming tests
timholy 52878f3
Update to JuliaLibWrapping .h file
timholy 106868a
Split `write_logfile` into separate function
timholy cb068c2
Update contrib/juliac/juliac-buildscript.jl
timholy c0e1c3e
Export ABI metadata in JSON format
topolarity a1b8349
Move ABI export functionality to `abi_export.jl`
topolarity 0a744d6
Print field / argument info more compactly
topolarity e1d3052
Add `--export-abi` arg to `juliac.jl`
topolarity d51511a
Add extra metadata for `primitive` types
topolarity 76057d4
Minor fix-up for makefile paths
topolarity f5ffa0c
Merge remote-tracking branch 'julialang/master' into teh/juliac_heade…
topolarity 0c38e91
Update header file to latest from `JuliaLibWrapping.jl`
topolarity 6fd68ec
Adjust to `Core.MethodTable` -> `Core.methodtable`
topolarity 77b1916
Minor fix-up for makefile paths
topolarity c8a0c0b
Update `test/trimming/trimming.jl` for JSON ABI format
topolarity af8e042
Rename `type` to `type_id`
topolarity 6161dab
Add recursive type tests
topolarity cb503ee
Update contrib/juliac/abi_export.jl
timholy 93a0557
Add isptr and isfieldatomic
timholy d9ea0eb
Merge branch 'master' into teh/juliac_headerlogs
timholy be561b7
Fix spacing
timholy 7adc37b
Debug tests
timholy 53b84e6
Remove project
timholy 4dfc45b
Remove module qualification
timholy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
/test/results_*.json | ||
/test/results_*.dat | ||
/test/deps | ||
/test/trimming/Manifest.toml | ||
|
||
*.expmap | ||
*.exe | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <stdio.h> | ||
#include "libsimple.h" | ||
|
||
int main() { | ||
// Example usage of the functions defined in libsimple.h | ||
CVectorPair_float_ vecPair; | ||
vecPair.from.length = 3; | ||
vecPair.from.data = (float[]){1.0f, 2.0f, 3.0f}; | ||
vecPair.to.length = 3; | ||
vecPair.to.data = (float[]){4.0f, 5.0f, 6.0f}; | ||
|
||
float sum = copyto_and_sum(vecPair); | ||
printf("Sum of copied values: %f\n", sum); | ||
|
||
MyTwoVec list[] = {{1, 2}, {5, 5}, {3, 4}}; | ||
int32_t count = countsame(list, 3); | ||
printf("Count of same vectors: %d\n", count); | ||
|
||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef JULIALIB_LIBSIMPLE_H | ||
#define JULIALIB_LIBSIMPLE_H | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
typedef struct { | ||
int32_t length; | ||
float * data; | ||
} CVector_float_; | ||
typedef struct { | ||
CVector_float_ from; | ||
CVector_float_ to; | ||
} CVectorPair_float_; | ||
typedef struct { | ||
int32_t x; | ||
int32_t y; | ||
} MyTwoVec; | ||
|
||
int32_t countsame(MyTwoVec * list, int32_t n); | ||
float copyto_and_sum(CVectorPair_float_ fromto); | ||
#endif // JULIALIB_LIBSIMPLE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module SimpleLib | ||
# Test the logging of entrypoints and types in a C-callable Julia library. | ||
|
||
struct CVector{T} | ||
length::Cint | ||
data::Ptr{T} | ||
end | ||
|
||
struct CVectorPair{T} | ||
from::CVector{T} | ||
to::CVector{T} | ||
end | ||
|
||
struct MyTwoVec | ||
x::Int32 | ||
y::Int32 | ||
end | ||
|
||
Base.@ccallable "copyto_and_sum" function badname(fromto::CVectorPair{Float32})::Float32 | ||
from, to = unsafe_wrap(Array, fromto.from.data, fromto.from.length), unsafe_wrap(Array, fromto.to.data, fromto.to.length) | ||
copyto!(to, from) | ||
return sum(to) | ||
end | ||
|
||
Base.@ccallable function countsame(list::Ptr{MyTwoVec}, n::Int32)::Int32 | ||
topolarity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
list = unsafe_wrap(Array, list, n) | ||
count = 0 | ||
for v in list | ||
count += v.x == v.y | ||
end | ||
return count | ||
end | ||
|
||
export countsame, copyto_and_sum | ||
|
||
# FIXME? varargs | ||
# Base.@ccallable function printints(x::Cint...)::Nothing | ||
# for i in 1:length(x) | ||
# print(x[i], " ") | ||
# end | ||
# println() | ||
# end | ||
|
||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.