Skip to content

Commit

Permalink
[cxx] Fixes for all lanes to build as C++ but w/o configure.ac change. (
Browse files Browse the repository at this point in the history
mono/mono#17452)

* [cxx] dlmalloc remove extern "C" and remove NO_MALLINFO.

* [cxx] Move CallInst bitfields to the end to minimize padding for alignment
and fix an unexplained LLVM problem.


Commit migrated from mono/mono@dc866c2
  • Loading branch information
jaykrell authored and lewurm committed Jan 14, 2020
1 parent 3120df2 commit 11b903f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 48 deletions.
36 changes: 20 additions & 16 deletions src/mono/mono/mini/mini.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,16 +783,34 @@ struct MonoCallInst {
MonoInst *out_args;
MonoInst *vret_var;
gconstpointer fptr;
MonoJitICallId jit_icall_id;
guint stack_usage;
guint stack_align_amount;
regmask_t used_iregs;
regmask_t used_fregs;
GSList *out_ireg_args;
GSList *out_freg_args;
GSList *outarg_vts;
CallInfo *call_info;
#ifdef ENABLE_LLVM
LLVMCallInfo *cinfo;
int rgctx_arg_reg, imt_arg_reg;
#endif
#ifdef TARGET_ARM
/* See the comment in mini-arm.c!mono_arch_emit_call for RegTypeFP. */
GSList *float_args;
#endif
// Bitfields are at the end due to an unexplained problem with C++ and LLVM.
// This is also their ideal place to minimize padding for alignment,
// unless there is a placement to increase locality.

guint is_virtual : 1;
// FIXME tailcall field is written after read; prefer MONO_IS_TAILCALL_OPCODE.
guint tailcall : 1;
/* If this is TRUE, 'fptr' points to a MonoJumpInfo instead of an address. */
guint fptr_is_patch : 1;
MonoJitICallId jit_icall_id;
/*
* If this is true, then the call returns a vtype in a register using the same
* If this is true, then the call returns a vtype in a register using the same
* calling convention as OP_CALL.
*/
guint vret_in_reg : 1;
Expand All @@ -804,20 +822,6 @@ struct MonoCallInst {
guint32 rgctx_reg : 1;
/* Whenever the call will need an unbox trampoline */
guint need_unbox_trampoline : 1;
regmask_t used_iregs;
regmask_t used_fregs;
GSList *out_ireg_args;
GSList *out_freg_args;
GSList *outarg_vts;
CallInfo *call_info;
#ifdef ENABLE_LLVM
LLVMCallInfo *cinfo;
int rgctx_arg_reg, imt_arg_reg;
#endif
#ifdef TARGET_ARM
/* See the comment in mini-arm.c!mono_arch_emit_call for RegTypeFP. */
GSList *float_args;
#endif
};

struct MonoCallArgParm {
Expand Down
8 changes: 0 additions & 8 deletions src/mono/mono/utils/dlmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,6 @@ struct mallinfo {
#endif /* HAVE_USR_INCLUDE_MALLOC_H */
#endif /* NO_MALLINFO */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#if !ONLY_MSPACES

/* ------------------- Declarations of public routines ------------------- */
Expand Down Expand Up @@ -1146,10 +1142,6 @@ int mspace_mallopt(int, int);

#endif /* MSPACES */

#ifdef __cplusplus
}; /* end of extern "C" */
#endif /* __cplusplus */

/*
========================================================================
To make a fully customizable malloc.h header file, cut everything
Expand Down
24 changes: 0 additions & 24 deletions src/mono/mono/utils/dlmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@
#include <stddef.h> /* for size_t */
#include <mono/utils/mono-compiler.h>

// Returning an undefined struct by value from extern "C"
// is sometimes an error. Mono does not use the code (dlmallinfo)..
//
// Other fixes:
// - define the struct
// - #if __cplusplus
// - #if HOST_WASM
// - #ifndef HAVE_USR_INCLUDE_MALLOC_H
// - Make it not extern "C".
// - Return the struct through an out parameter.
// - remove extern "C" entirely in dlmalloc.
//
// Mono does not use the function (dlmallinfo).
//
#define NO_MALLINFO 1 /* mono */

#ifdef __cplusplus
extern "C" {
#endif

#if !ONLY_MSPACES

#ifndef USE_DL_PREFIX
Expand Down Expand Up @@ -554,8 +534,4 @@ int mspace_mallopt(int, int);

#endif /* MSPACES */

#ifdef __cplusplus
}; /* end of extern "C" */
#endif

#endif /* MALLOC_280_H */

0 comments on commit 11b903f

Please sign in to comment.