Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Hold native callsite info at an extra indirection.
This will help support inlining it into a P6opaque.
- Loading branch information
Showing
4 changed files
with
48 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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 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
35 changes: 35 additions & 0 deletions
35
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeCallBody.java
This file contains 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,35 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import com.sun.jna.Function; | ||
|
|
||
| /* Holds a description of a native call site. */ | ||
| public class NativeCallBody { | ||
| /* Flag for whether we should free a string after passing it or not. These | ||
| * are going away once the array handling is refactored.*/ | ||
| public static final byte ARG_NO_FREE_STR = 0; | ||
| public static final byte ARG_FREE_STR = 1; | ||
| public static final byte ARG_FREE_STR_MASK = 1; | ||
|
|
||
| /* The available native call argument types. */ | ||
| public enum ArgType { | ||
| VOID, | ||
| CHAR, | ||
| SHORT, | ||
| INT, | ||
| LONG, | ||
| LONGLONG, | ||
| FLOAT, | ||
| DOUBLE, | ||
| ASCIISTR, | ||
| UTF8STR, | ||
| UTF16STR, | ||
| CSTRUCT, | ||
| CARRAY, | ||
| CALLBACK, | ||
| CPOINTER; | ||
| } | ||
|
|
||
| public Function entry_point; | ||
| public ArgType[] arg_types; | ||
| public ArgType ret_type; | ||
| } |
33 changes: 4 additions & 29 deletions
33
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeCallInstance.java
This file contains 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 |
|---|---|---|
| @@ -1,35 +1,10 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import com.sun.jna.Function; | ||
|
|
||
| import org.perl6.nqp.sixmodel.SixModelObject; | ||
|
|
||
| public class NativeCallInstance extends SixModelObject { | ||
| /* Flag for whether we should free a string after passing it or not. These | ||
| * are going away once the array handling is refactored.*/ | ||
| public static final byte ARG_NO_FREE_STR = 0; | ||
| public static final byte ARG_FREE_STR = 1; | ||
| public static final byte ARG_FREE_STR_MASK = 1; | ||
|
|
||
| public Function entry_point; | ||
| public ArgType[] arg_types; | ||
| public ArgType ret_type; | ||
|
|
||
| public enum ArgType { | ||
| VOID, | ||
| CHAR, | ||
| SHORT, | ||
| INT, | ||
| LONG, | ||
| LONGLONG, | ||
| FLOAT, | ||
| DOUBLE, | ||
| ASCIISTR, | ||
| UTF8STR, | ||
| UTF16STR, | ||
| CSTRUCT, | ||
| CARRAY, | ||
| CALLBACK, | ||
| CPOINTER; | ||
| } | ||
| /* Body held at a level of indirection to support inlining that into a | ||
| * P6opaque; this is about the best we can do on the JVM, which doesn't | ||
| * support interior pointers of complex value types. */ | ||
| public NativeCallBody body; | ||
| } |