Skip to content

Delete unused native code in src/native #67087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/native/corehost/fxr/fx_ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ struct fx_ver_t
int get_minor() const { return m_minor; }
int get_patch() const { return m_patch; }

void set_major(int m) { m_major = m; }
void set_minor(int m) { m_minor = m; }
void set_patch(int p) { m_patch = p; }

bool is_prerelease() const { return !m_pre.empty(); }

bool is_empty() const { return m_major == -1; }
Expand Down
7 changes: 1 addition & 6 deletions src/native/corehost/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ struct version_t
int get_major() const { return m_major; }
int get_minor() const { return m_minor; }
int get_build() const { return m_build; }
int get_revision() const { return m_revision; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @elinor-fung @vitek-karas for corehost sub-dir.


void set_major(int m) { m_major = m; }
void set_minor(int m) { m_minor = m; }
void set_build(int m) { m_build = m; }
void set_revision(int m) { m_revision = m; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can actually remove all the set_* in version_t and fx_ver_t.

// int get_revision() const { return m_revision; }

pal::string_t as_str() const;

Expand Down
33 changes: 0 additions & 33 deletions src/native/eventpipe/ds-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,12 @@ ds_ipc_message_try_parse_uint64_t (
uint32_t *buffer_len,
uint64_t *value);

static
inline
bool
ds_ipc_message_try_parse_int64_t (
uint8_t **buffer,
uint32_t *buffer_len,
int64_t *value)
{
return ds_ipc_message_try_parse_uint64_t (buffer, buffer_len, (uint64_t *)value);
}

bool
ds_ipc_message_try_parse_uint32_t (
uint8_t **buffer,
uint32_t *buffer_len,
uint32_t *value);

static
inline
bool
ds_ipc_message_try_parse_int32_t (
uint8_t **buffer,
uint32_t *buffer_len,
int32_t *value)
{
return ds_ipc_message_try_parse_uint32_t (buffer, buffer_len, (uint32_t *)value);
}

bool
ds_ipc_message_try_parse_string_utf16_t_byte_array_alloc (
uint8_t **buffer,
Expand Down Expand Up @@ -181,17 +159,6 @@ ds_ipc_message_initialize_header_uint64_t_payload (
const DiagnosticsIpcHeader *header,
uint64_t payload);

static
inline
bool
ds_ipc_message_initialize_header_int64_t_payload (
DiagnosticsIpcMessage *message,
const DiagnosticsIpcHeader *header,
int64_t payload)
{
return ds_ipc_message_initialize_header_uint64_t_payload (message, header, (uint64_t)payload);
}

bool
ds_ipc_message_initialize_buffer (
DiagnosticsIpcMessage *message,
Expand Down
8 changes: 0 additions & 8 deletions src/native/eventpipe/ep-sample-profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ sample_profiler_store_profiling_enabled (bool enabled)
ep_rt_volatile_store_uint32_t (&_profiling_enabled, enabled ? 1 : 0);
}

static
inline
bool
sample_profiler_load_can_start_sampling (void)
{
return (ep_rt_volatile_load_uint32_t (&_can_start_sampling) != 0) ? true : false;
}

static
inline
void
Expand Down
14 changes: 0 additions & 14 deletions src/native/eventpipe/ep-stack-contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ ep_stack_contents_get_length (EventPipeStackContents *stack_contents)
return ep_stack_contents_get_next_available_frame (stack_contents);
}

static
inline
uintptr_t
ep_stack_contents_get_ip (
EventPipeStackContents *stack_contents,
uint32_t frame_index)
{
EP_ASSERT (frame_index < EP_MAX_STACK_DEPTH);
if (frame_index >= EP_MAX_STACK_DEPTH)
return 0;

return ep_stack_contents_get_stack_frames_cref (stack_contents)[frame_index];
}

#ifdef EP_CHECKED_BUILD
static
inline
Expand Down
52 changes: 0 additions & 52 deletions src/native/eventpipe/ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ ep_volatile_store_eventpipe_state (EventPipeState state)
ep_rt_volatile_store_uint32_t ((volatile uint32_t *)&_ep_state, state);
}

static
inline
void
ep_volatile_store_eventpipe_state_without_barrier (EventPipeState state)
{
ep_rt_volatile_store_uint32_t_without_barrier ((volatile uint32_t *)&_ep_state, state);
}

static
inline
EventPipeSession *
Expand All @@ -73,14 +65,6 @@ ep_volatile_store_session (size_t index, EventPipeSession *session)
ep_rt_volatile_store_ptr ((volatile void **)(&_ep_sessions [index]), session);
}

static
inline
void
ep_volatile_store_session_without_barrier (size_t index, EventPipeSession *session)
{
ep_rt_volatile_store_ptr_without_barrier ((volatile void **)(&_ep_sessions [index]), session);
}

static
inline
uint32_t
Expand All @@ -105,14 +89,6 @@ ep_volatile_store_number_of_sessions (uint32_t number_of_sessions)
ep_rt_volatile_store_uint32_t (&_ep_number_of_sessions, number_of_sessions);
}

static
inline
void
ep_volatile_store_number_of_sessions_without_barrier (uint32_t number_of_sessions)
{
ep_rt_volatile_store_uint32_t_without_barrier (&_ep_number_of_sessions, number_of_sessions);
}

static
inline
uint64_t
Expand All @@ -121,14 +97,6 @@ ep_volatile_load_allow_write (void)
return ep_rt_volatile_load_uint64_t (&_ep_allow_write);
}

static
inline
uint64_t
ep_volatile_load_allow_write_without_barrier (void)
{
return ep_rt_volatile_load_uint64_t_without_barrier (&_ep_allow_write);
}

static
inline
void
Expand All @@ -137,14 +105,6 @@ ep_volatile_store_allow_write (uint64_t allow_write)
ep_rt_volatile_store_uint64_t (&_ep_allow_write, allow_write);
}

static
inline
void
ep_volatile_store_allow_write_without_barrier (uint64_t allow_write)
{
ep_rt_volatile_store_uint64_t_without_barrier (&_ep_allow_write, allow_write);
}

/*
* EventPipe.
*/
Expand Down Expand Up @@ -276,18 +236,6 @@ ep_walk_managed_stack_for_current_thread (EventPipeStackContents *stack_contents
return (thread != NULL) ? ep_rt_walk_managed_stack_for_thread (thread, stack_contents) : false;
}

static
inline
bool
ep_walk_managed_stack_for_thread (ep_rt_thread_handle_t thread, EventPipeStackContents *stack_contents)
{
EP_ASSERT (thread != NULL);
EP_ASSERT (stack_contents != NULL);

ep_stack_contents_reset (stack_contents);
return (thread != NULL) ? ep_rt_walk_managed_stack_for_thread (thread, stack_contents) : false;
}

bool
ep_add_rundown_execution_checkpoint (
const ep_char8_t *name,
Expand Down
2 changes: 0 additions & 2 deletions src/native/libs/Common/pal_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#cmakedefine01 HAVE_NON_LEGACY_STATFS
#cmakedefine01 HAVE_STRCPY_S
#cmakedefine01 HAVE_STRLCPY
#cmakedefine01 HAVE_STRCAT_S
#cmakedefine01 HAVE_STRLCAT
#cmakedefine01 HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP
#cmakedefine01 HAVE_POSIX_ADVISE
#cmakedefine01 HAVE_FALLOCATE
Expand Down
18 changes: 0 additions & 18 deletions src/native/libs/Common/pal_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,6 @@ inline static void SafeStringCopy(char* destination, size_t destinationSize, con
#endif
}

/**
* Abstraction helper method to safely copy strings using strlcpy or strcpy_s
* or a different safe copy method, depending on the current platform.
*/
inline static void SafeStringConcat(char* destination, size_t destinationSize, const char* str1, const char* str2)
{
memset(destination, 0, destinationSize);
#if HAVE_STRCAT_S
strcat_s(destination, destinationSize, str1);
strcat_s(destination, destinationSize, str2);
#elif HAVE_STRLCAT
strlcat(destination, str1, destinationSize);
strlcat(destination, str2, destinationSize);
#else
snprintf(destination, destinationSize, "%s%s", str1, str2);
#endif
}

/**
* Converts an intptr_t to a file descriptor.
* intptr_t is the type used to marshal file descriptors so we can use SafeHandles effectively.
Expand Down
10 changes: 0 additions & 10 deletions src/native/libs/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,6 @@ check_symbol_exists(
string.h
HAVE_STRCPY_S)

check_symbol_exists(
strlcpy
string.h
HAVE_STRLCPY)

check_symbol_exists(
strcat_s
string.h
HAVE_STRCAT_S)

check_symbol_exists(
strlcat
string.h
Expand Down