{"action":"created","issue":{"url":"https://api.github.com/repos/jnr/jnr-ffi/issues/86","repository_url":"https://api.github.com/repos/jnr/jnr-ffi","labels_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/86/comments","events_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/86/events","html_url":"https://github.com/jnr/jnr-ffi/issues/86","id":179877433,"number":86,"title":"Utilize critical jffi invokes to bind compatible functions and pass-through primitives","user":{"login":"headius","id":10135,"avatar_url":"https://avatars.githubusercontent.com/u/10135?v=3","gravatar_id":"","url":"https://api.github.com/users/headius","html_url":"https://github.com/headius","followers_url":"https://api.github.com/users/headius/followers","following_url":"https://api.github.com/users/headius/following{/other_user}","gists_url":"https://api.github.com/users/headius/gists{/gist_id}","starred_url":"https://api.github.com/users/headius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/headius/subscriptions","organizations_url":"https://api.github.com/users/headius/orgs","repos_url":"https://api.github.com/users/headius/repos","events_url":"https://api.github.com/users/headius/events{/privacy}","received_events_url":"https://api.github.com/users/headius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-28T20:17:50Z","updated_at":"2016-09-28T20:26:32Z","closed_at":null,"body":"While discussing ways to implement #68, user @spasi opened our eyes to the magic of HotSpot's JavaCritical \"Critical Natives\" feature described here:\r\n\r\nhttp://stackoverflow.com/questions/36298111/is-it-possible-to-use-sun-misc-unsafe-to-call-c-functions-without-jni/36309652#36309652\r\n\r\nThe potential for jnr-* here is tremendous:\r\n\r\n* We could make critical-compatible function calls much cheaper...possibly no overhead at all.\r\n* We could provide better performance for calls that pass around arrays of primitives, like IO operations.\r\n\r\nIn thinking through the original feature request at #68 and combining it with the whirl of ideas going through my head right now, here's some rough direction...\r\n\r\nBasically we'd add new invoke endpoints to jffi that are JavaCritical. When supported and requested by a user (jnr-ffi on up, probably an annotation), we'd use these endpoints to do invocation. Ignoring the function called, we already meet most of the requirements for JavaCritical since most (all?) forms of Foreign.invoke just takes primitive arguments.\r\n\r\nThis would feed into supporting primitive arrays, since a JavaCritical-assisted FFI-bound function could get at that array directly. This would probably be done via a parameter annotation indicating that the array should be passed through following JavaCritical's requirements, and on the other side our new endpoints would pass it on to the function.\r\n\r\nIt seems like the initial work to add new JavaCritical endpoints and support for them in jnr-* wouldn't be too bad. It's the first change in a long time that requires rebuilding all our native bits, but there's compelling reasons to go forward."},"comment":{"url":"https://api.github.com/repos/jnr/jnr-ffi/issues/comments/250289187","html_url":"https://github.com/jnr/jnr-ffi/issues/86#issuecomment-250289187","issue_url":"https://api.github.com/repos/jnr/jnr-ffi/issues/86","id":250289187,"user":{"login":"headius","id":10135,"avatar_url":"https://avatars.githubusercontent.com/u/10135?v=3","gravatar_id":"","url":"https://api.github.com/users/headius","html_url":"https://github.com/headius","followers_url":"https://api.github.com/users/headius/followers","following_url":"https://api.github.com/users/headius/following{/other_user}","gists_url":"https://api.github.com/users/headius/gists{/gist_id}","starred_url":"https://api.github.com/users/headius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/headius/subscriptions","organizations_url":"https://api.github.com/users/headius/orgs","repos_url":"https://api.github.com/users/headius/repos","events_url":"https://api.github.com/users/headius/events{/privacy}","received_events_url":"https://api.github.com/users/headius/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T20:26:32Z","updated_at":"2016-09-28T20:26:32Z","body":"Reference jnr/jffi#34."}}
{"actor":{"display_login":"headius"}}