Skip to content

Commit

Permalink
Change CStruct For Compatibility With Native Call JIT
Browse files Browse the repository at this point in the history
Having the pointer to the actual data be first in
the struct lets us handle a CStruct exactly like
most other things in there.
  • Loading branch information
timo committed Feb 10, 2019
1 parent 215430c commit efdf568
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/6model/reprs/CStruct.h
Expand Up @@ -19,13 +19,13 @@
* C-friendly bit of memory and a copy to the GC-able, 6model objects in
* sync. */
struct MVMCStructBody {
/* GC-marked objects that our C structure points into. */
MVMObject **child_objs;

/* Pointer to the actual C structure memory; we don't inline it
* directly in the body, since it doesn't work so well if we get
* something returned and are wrapping it. */
void *cstruct;

/* GC-marked objects that our C structure points into. */
MVMObject **child_objs;
};

struct MVMCStruct {
Expand Down
4 changes: 4 additions & 0 deletions src/core/nativecall.c
Expand Up @@ -535,6 +535,10 @@ MVMJitGraph *MVM_nativecall_jit_graph_for_caller_code(
case MVM_NATIVECALL_ARG_UTF8STR:
if (is_rw) goto fail;
continue; /* already handled */
case MVM_NATIVECALL_ARG_CSTRUCT:
if (is_rw) goto fail;
arg_type = dst == -1 ? MVM_JIT_ARG_PTR : MVM_JIT_PARAM_PTR;
break;
default:
goto fail;
}
Expand Down

0 comments on commit efdf568

Please sign in to comment.