Skip to content
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

Mark as inline functions implemented in src/serialize.h #44739

Merged
merged 3 commits into from
Apr 1, 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
22 changes: 11 additions & 11 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,54 +67,54 @@ extern "C" {
#define LAST_TAG 57

#define write_uint8(s, n) ios_putc((n), (s))
#define read_uint8(s) ((uint8_t)ios_getc(s))
#define write_int8(s, n) write_uint8(s, n)
#define read_int8(s) read_uint8(s)
#define read_uint8(s) ((uint8_t)ios_getc((s)))
#define write_int8(s, n) write_uint8((s), (n))
#define read_int8(s) read_uint8((s))
staticfloat marked this conversation as resolved.
Show resolved Hide resolved

/* read and write in host byte order */

static void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT
static inline void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT
{
ios_write(s, (char*)&i, 4);
}

static int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT
static inline int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT
{
int32_t x = 0;
ios_read(s, (char*)&x, 4);
return x;
}

static uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT
static inline uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT
{
uint64_t x = 0;
ios_read(s, (char*)&x, 8);
return x;
}

static void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT
static inline void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT
{
ios_write(s, (char*)&i, 8);
}

static void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT
static inline void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT
{
ios_write(s, (char*)&i, 2);
}

static uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT
static inline uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT
{
int16_t x = 0;
ios_read(s, (char*)&x, 2);
return x;
}

static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
static inline void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
{
ios_write(s, (char*)&i, 4);
}

static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
static inline uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
{
uint32_t x = 0;
ios_read(s, (char*)&x, 4);
Expand Down
20 changes: 1 addition & 19 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ done by `get_item_for_reloc`.
#include "julia_internal.h"
#include "builtin_proto.h"
#include "processor.h"
#include "serialize.h"

#ifndef _OS_WINDOWS_
#include <dlfcn.h>
Expand Down Expand Up @@ -364,25 +365,6 @@ typedef enum {
// if a larger size is required, will need to add support for writing larger relocations in many cases below
#define RELOC_TAG_OFFSET 29


/* read and write in host byte order */

#define write_uint8(s, n) ios_putc((n), (s))
#define read_uint8(s) ((uint8_t)ios_getc((s)))

static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
{
ios_write(s, (char*)&i, 4);
}

static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
{
uint32_t x = 0;
ios_read(s, (char*)&x, 4);
return x;
}


// --- Static Compile ---

static void *jl_sysimg_handle = NULL;
Expand Down