Skip to content

Commit 2c8b2dc

Browse files
committed
[ORC-RT] Rename 'orc_rt_*CWrapper*' types and functions to 'orc_rt_*Wrapper*'.
The orc_rt_ prefix implies C API anyway (the C++ API should use the orc_rc:: namespace), so the 'C' is redundant here.
1 parent f984b47 commit 2c8b2dc

File tree

10 files changed

+156
-154
lines changed

10 files changed

+156
-154
lines changed

compiler-rt/include/orc_rt/c_api.h

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,46 +48,46 @@ ORC_RT_C_EXTERN_C_BEGIN
4848
typedef union {
4949
char *ValuePtr;
5050
char Value[sizeof(char *)];
51-
} orc_rt_CWrapperFunctionResultDataUnion;
51+
} orc_rt_WrapperFunctionResultDataUnion;
5252

5353
/**
54-
* orc_rt_CWrapperFunctionResult is a kind of C-SmallVector with an
54+
* orc_rt_WrapperFunctionResult is a kind of C-SmallVector with an
5555
* out-of-band error state.
5656
*
5757
* If Size == 0 and Data.ValuePtr is non-zero then the value is in the
5858
* 'out-of-band error' state, and Data.ValuePtr points at a malloc-allocated,
5959
* null-terminated string error message.
6060
*
61-
* If Size <= sizeof(orc_rt_CWrapperFunctionResultData) then the value is in
61+
* If Size <= sizeof(orc_rt_WrapperFunctionResultData) then the value is in
6262
* the 'small' state and the content is held in the first Size bytes of
6363
* Data.Value.
6464
*
65-
* If Size > sizeof(orc_rt_CWrapperFunctionResultData) then the value is in the
65+
* If Size > sizeof(orc_rt_WrapperFunctionResultData) then the value is in the
6666
* 'large' state and the content is held in the first Size bytes of the
6767
* memory pointed to by Data.ValuePtr. This memory must have been allocated by
6868
* malloc, and will be freed with free when this value is destroyed.
6969
*/
7070
typedef struct {
71-
orc_rt_CWrapperFunctionResultDataUnion Data;
71+
orc_rt_WrapperFunctionResultDataUnion Data;
7272
size_t Size;
73-
} orc_rt_CWrapperFunctionResult;
73+
} orc_rt_WrapperFunctionResult;
7474

7575
/**
76-
* Zero-initialize an orc_rt_CWrapperFunctionResult.
76+
* Zero-initialize an orc_rt_WrapperFunctionResult.
7777
*/
7878
static inline void
79-
orc_rt_CWrapperFunctionResultInit(orc_rt_CWrapperFunctionResult *R) {
79+
orc_rt_WrapperFunctionResultInit(orc_rt_WrapperFunctionResult *R) {
8080
R->Size = 0;
8181
R->Data.ValuePtr = 0;
8282
}
8383

8484
/**
85-
* Create an orc_rt_CWrapperFunctionResult with an uninitialized buffer of
85+
* Create an orc_rt_WrapperFunctionResult with an uninitialized buffer of
8686
* size Size. The buffer is returned via the DataPtr argument.
8787
*/
88-
static inline orc_rt_CWrapperFunctionResult
89-
orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
90-
orc_rt_CWrapperFunctionResult R;
88+
static inline orc_rt_WrapperFunctionResult
89+
orc_rt_WrapperFunctionResultAllocate(size_t Size) {
90+
orc_rt_WrapperFunctionResult R;
9191
R.Size = Size;
9292
// If Size is 0 ValuePtr must be 0 or it is considered an out-of-band error.
9393
R.Data.ValuePtr = 0;
@@ -99,9 +99,9 @@ orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
9999
/**
100100
* Create an orc_rt_WrapperFunctionResult from the given data range.
101101
*/
102-
static inline orc_rt_CWrapperFunctionResult
103-
orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
104-
orc_rt_CWrapperFunctionResult R;
102+
static inline orc_rt_WrapperFunctionResult
103+
orc_rt_CreateWrapperFunctionResultFromRange(const char *Data, size_t Size) {
104+
orc_rt_WrapperFunctionResult R;
105105
R.Size = Size;
106106
if (R.Size > sizeof(R.Data.Value)) {
107107
char *Tmp = (char *)malloc(Size);
@@ -113,28 +113,28 @@ orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
113113
}
114114

115115
/**
116-
* Create an orc_rt_CWrapperFunctionResult by copying the given string,
116+
* Create an orc_rt_WrapperFunctionResult by copying the given string,
117117
* including the null-terminator.
118118
*
119119
* This function copies the input string. The client is responsible for freeing
120120
* the ErrMsg arg.
121121
*/
122-
static inline orc_rt_CWrapperFunctionResult
123-
orc_rt_CreateCWrapperFunctionResultFromString(const char *Source) {
124-
return orc_rt_CreateCWrapperFunctionResultFromRange(Source,
125-
strlen(Source) + 1);
122+
static inline orc_rt_WrapperFunctionResult
123+
orc_rt_CreateWrapperFunctionResultFromString(const char *Source) {
124+
return orc_rt_CreateWrapperFunctionResultFromRange(Source,
125+
strlen(Source) + 1);
126126
}
127127

128128
/**
129-
* Create an orc_rt_CWrapperFunctionResult representing an out-of-band
129+
* Create an orc_rt_WrapperFunctionResult representing an out-of-band
130130
* error.
131131
*
132132
* This function copies the input string. The client is responsible for freeing
133133
* the ErrMsg arg.
134134
*/
135-
static inline orc_rt_CWrapperFunctionResult
136-
orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
137-
orc_rt_CWrapperFunctionResult R;
135+
static inline orc_rt_WrapperFunctionResult
136+
orc_rt_CreateWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
137+
orc_rt_WrapperFunctionResult R;
138138
R.Size = 0;
139139
char *Tmp = (char *)malloc(strlen(ErrMsg) + 1);
140140
strcpy(Tmp, ErrMsg);
@@ -143,57 +143,57 @@ orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
143143
}
144144

145145
/**
146-
* This should be called to destroy orc_rt_CWrapperFunctionResult values
146+
* This should be called to destroy orc_rt_WrapperFunctionResult values
147147
* regardless of their state.
148148
*/
149149
static inline void
150-
orc_rt_DisposeCWrapperFunctionResult(orc_rt_CWrapperFunctionResult *R) {
150+
orc_rt_DisposeWrapperFunctionResult(orc_rt_WrapperFunctionResult *R) {
151151
if (R->Size > sizeof(R->Data.Value) ||
152152
(R->Size == 0 && R->Data.ValuePtr))
153153
free(R->Data.ValuePtr);
154154
}
155155

156156
/**
157157
* Get a pointer to the data contained in the given
158-
* orc_rt_CWrapperFunctionResult.
158+
* orc_rt_WrapperFunctionResult.
159159
*/
160160
static inline char *
161-
orc_rt_CWrapperFunctionResultData(orc_rt_CWrapperFunctionResult *R) {
161+
orc_rt_WrapperFunctionResultData(orc_rt_WrapperFunctionResult *R) {
162162
assert((R->Size != 0 || R->Data.ValuePtr == NULL) &&
163163
"Cannot get data for out-of-band error value");
164164
return R->Size > sizeof(R->Data.Value) ? R->Data.ValuePtr : R->Data.Value;
165165
}
166166

167167
/**
168-
* Safely get the size of the given orc_rt_CWrapperFunctionResult.
168+
* Safely get the size of the given orc_rt_WrapperFunctionResult.
169169
*
170170
* Asserts that we're not trying to access the size of an error value.
171171
*/
172172
static inline size_t
173-
orc_rt_CWrapperFunctionResultSize(const orc_rt_CWrapperFunctionResult *R) {
173+
orc_rt_WrapperFunctionResultSize(const orc_rt_WrapperFunctionResult *R) {
174174
assert((R->Size != 0 || R->Data.ValuePtr == NULL) &&
175175
"Cannot get size for out-of-band error value");
176176
return R->Size;
177177
}
178178

179179
/**
180180
* Returns 1 if this value is equivalent to a value just initialized by
181-
* orc_rt_CWrapperFunctionResultInit, 0 otherwise.
181+
* orc_rt_WrapperFunctionResultInit, 0 otherwise.
182182
*/
183183
static inline size_t
184-
orc_rt_CWrapperFunctionResultEmpty(const orc_rt_CWrapperFunctionResult *R) {
184+
orc_rt_WrapperFunctionResultEmpty(const orc_rt_WrapperFunctionResult *R) {
185185
return R->Size == 0 && R->Data.ValuePtr == 0;
186186
}
187187

188188
/**
189189
* Returns a pointer to the out-of-band error string for this
190-
* orc_rt_CWrapperFunctionResult, or null if there is no error.
190+
* orc_rt_WrapperFunctionResult, or null if there is no error.
191191
*
192-
* The orc_rt_CWrapperFunctionResult retains ownership of the error
192+
* The orc_rt_WrapperFunctionResult retains ownership of the error
193193
* string, so it should be copied if the caller wishes to preserve it.
194194
*/
195-
static inline const char *orc_rt_CWrapperFunctionResultGetOutOfBandError(
196-
const orc_rt_CWrapperFunctionResult *R) {
195+
static inline const char *orc_rt_WrapperFunctionResultGetOutOfBandError(
196+
const orc_rt_WrapperFunctionResult *R) {
197197
return R->Size == 0 ? R->Data.ValuePtr : 0;
198198
}
199199

compiler-rt/lib/orc/coff_platform.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,19 +594,19 @@ void *COFFPlatformRuntimeState::findJITDylibBaseByPC(uint64_t PC) {
594594
return Range.Header;
595595
}
596596

597-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
597+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
598598
__orc_rt_coff_platform_bootstrap(char *ArgData, size_t ArgSize) {
599599
COFFPlatformRuntimeState::initialize();
600600
return WrapperFunctionResult().release();
601601
}
602602

603-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
603+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
604604
__orc_rt_coff_platform_shutdown(char *ArgData, size_t ArgSize) {
605605
COFFPlatformRuntimeState::destroy();
606606
return WrapperFunctionResult().release();
607607
}
608608

609-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
609+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
610610
__orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
611611
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
612612
ArgData, ArgSize,
@@ -617,7 +617,7 @@ __orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
617617
.release();
618618
}
619619

620-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
620+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
621621
__orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
622622
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
623623
ArgData, ArgSize,
@@ -628,7 +628,7 @@ __orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
628628
.release();
629629
}
630630

631-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
631+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
632632
__orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
633633
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap,
634634
bool)>::
@@ -643,7 +643,7 @@ __orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
643643
.release();
644644
}
645645

646-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
646+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
647647
__orc_rt_coff_deregister_object_sections(char *ArgData, size_t ArgSize) {
648648
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap)>::
649649
handle(ArgData, ArgSize,

compiler-rt/lib/orc/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ORC_RT_IMPORT __orc_rt_Opaque __orc_rt_jit_dispatch_ctx ORC_RT_WEAK_IMPORT;
4141
/// This is declared for use by the runtime, but should be implemented in the
4242
/// executor or provided by a definition added to the JIT before the runtime
4343
/// is loaded.
44-
ORC_RT_IMPORT orc_rt_CWrapperFunctionResult
44+
ORC_RT_IMPORT orc_rt_WrapperFunctionResult
4545
__orc_rt_jit_dispatch(__orc_rt_Opaque *DispatchCtx, const void *FnTag,
4646
const char *Data, size_t Size) ORC_RT_WEAK_IMPORT;
4747

compiler-rt/lib/orc/dlfcn_wrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
2323
extern "C" int __orc_rt_jit_dlupdate(void *dso_handle);
2424
extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
2525

26-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
26+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
2727
__orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
2828
return WrapperFunction<SPSString()>::handle(
2929
ArgData, ArgSize,
3030
[]() { return std::string(__orc_rt_jit_dlerror()); })
3131
.release();
3232
}
3333

34-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
34+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
3535
__orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
3636
return WrapperFunction<SPSExecutorAddr(SPSString, int32_t)>::handle(
3737
ArgData, ArgSize,
@@ -43,7 +43,7 @@ __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
4343
}
4444

4545
#ifndef _WIN32
46-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
46+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
4747
__orc_rt_jit_dlupdate_wrapper(const char *ArgData, size_t ArgSize) {
4848
return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
4949
ArgData, ArgSize,
@@ -54,7 +54,7 @@ __orc_rt_jit_dlupdate_wrapper(const char *ArgData, size_t ArgSize) {
5454
}
5555
#endif
5656

57-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
57+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
5858
__orc_rt_jit_dlclose_wrapper(const char *ArgData, size_t ArgSize) {
5959
return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
6060
ArgData, ArgSize,

compiler-rt/lib/orc/elfnix_platform.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ void destroyELFNixTLVMgr(void *ELFNixTLVMgr) {
656656
// JIT entry points
657657
//------------------------------------------------------------------------------
658658

659-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
659+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
660660
__orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
661661
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
662662
ArgData, ArgSize,
@@ -668,7 +668,7 @@ __orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
668668
.release();
669669
}
670670

671-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
671+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
672672
__orc_rt_elfnix_platform_shutdown(char *ArgData, size_t ArgSize) {
673673
return WrapperFunction<SPSError()>::handle(
674674
ArgData, ArgSize,
@@ -679,7 +679,7 @@ __orc_rt_elfnix_platform_shutdown(char *ArgData, size_t ArgSize) {
679679
.release();
680680
}
681681

682-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
682+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
683683
__orc_rt_elfnix_register_jitdylib(char *ArgData, size_t ArgSize) {
684684
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
685685
ArgData, ArgSize,
@@ -690,7 +690,7 @@ __orc_rt_elfnix_register_jitdylib(char *ArgData, size_t ArgSize) {
690690
.release();
691691
}
692692

693-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
693+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
694694
__orc_rt_elfnix_deregister_jitdylib(char *ArgData, size_t ArgSize) {
695695
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
696696
ArgData, ArgSize,
@@ -701,7 +701,7 @@ __orc_rt_elfnix_deregister_jitdylib(char *ArgData, size_t ArgSize) {
701701
.release();
702702
}
703703

704-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
704+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
705705
__orc_rt_elfnix_register_init_sections(char *ArgData, size_t ArgSize) {
706706
return WrapperFunction<SPSError(SPSExecutorAddr,
707707
SPSSequence<SPSExecutorAddrRange>)>::
@@ -714,7 +714,7 @@ __orc_rt_elfnix_register_init_sections(char *ArgData, size_t ArgSize) {
714714
.release();
715715
}
716716

717-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
717+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
718718
__orc_rt_elfnix_deregister_init_sections(char *ArgData, size_t ArgSize) {
719719
return WrapperFunction<SPSError(SPSExecutorAddr,
720720
SPSSequence<SPSExecutorAddrRange>)>::
@@ -728,7 +728,7 @@ __orc_rt_elfnix_deregister_init_sections(char *ArgData, size_t ArgSize) {
728728
}
729729

730730
/// Wrapper function for registering metadata on a per-object basis.
731-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
731+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
732732
__orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
733733
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
734734
handle(ArgData, ArgSize,
@@ -740,7 +740,7 @@ __orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
740740
}
741741

742742
/// Wrapper for releasing per-object metadat.
743-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
743+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
744744
__orc_rt_elfnix_deregister_object_sections(char *ArgData, size_t ArgSize) {
745745
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
746746
handle(ArgData, ArgSize,
@@ -776,7 +776,7 @@ ORC_RT_INTERFACE ptrdiff_t ___orc_rt_elfnix_tlsdesc_resolver_impl(
776776
return TLVPtr - ThreadPointer;
777777
}
778778

779-
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
779+
ORC_RT_INTERFACE orc_rt_WrapperFunctionResult
780780
__orc_rt_elfnix_create_pthread_key(char *ArgData, size_t ArgSize) {
781781
return WrapperFunction<SPSExpected<uint64_t>(void)>::handle(
782782
ArgData, ArgSize,

0 commit comments

Comments
 (0)