MJIT: Merge mjit_unit.h into mjit_c.h

The distinction doesn't make much difference today.
This commit is contained in:
Takashi Kokubun 2022-11-29 21:32:16 -08:00
parent ecc15bc94a
commit 7a2b1364ef
4 changed files with 29 additions and 36 deletions

View File

@ -9809,8 +9809,8 @@ mjit.$(OBJEXT): {$(VPATH)}missing.h
mjit.$(OBJEXT): {$(VPATH)}mjit.c
mjit.$(OBJEXT): {$(VPATH)}mjit.h
mjit.$(OBJEXT): {$(VPATH)}mjit.rbinc
mjit.$(OBJEXT): {$(VPATH)}mjit_c.h
mjit.$(OBJEXT): {$(VPATH)}mjit_config.h
mjit.$(OBJEXT): {$(VPATH)}mjit_unit.h
mjit.$(OBJEXT): {$(VPATH)}node.h
mjit.$(OBJEXT): {$(VPATH)}onigmo.h
mjit.$(OBJEXT): {$(VPATH)}oniguruma.h
@ -10023,7 +10023,6 @@ mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.h
mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.rb
mjit_c.$(OBJEXT): {$(VPATH)}mjit_c.rbinc
mjit_c.$(OBJEXT): {$(VPATH)}mjit_compile_attr.inc
mjit_c.$(OBJEXT): {$(VPATH)}mjit_unit.h
mjit_c.$(OBJEXT): {$(VPATH)}node.h
mjit_c.$(OBJEXT): {$(VPATH)}ruby_assert.h
mjit_c.$(OBJEXT): {$(VPATH)}ruby_atomic.h

2
mjit.c
View File

@ -88,7 +88,7 @@
#include "vm_core.h"
#include "vm_callinfo.h"
#include "mjit.h"
#include "mjit_unit.h"
#include "mjit_c.h"
#include "gc.h"
#include "ruby_assert.h"
#include "ruby/debug.h"

View File

@ -1,19 +1,42 @@
// This file is parsed by tool/mjit/generate.rb to generate mjit_c.rb
#ifndef MJIT_COMPILER_H
#define MJIT_COMPILER_H
#ifndef MJIT_C_H
#define MJIT_C_H
#include "ruby/internal/config.h"
#include "vm_core.h"
#include "vm_callinfo.h"
#include "builtin.h"
#include "ccan/list/list.h"
#include "mjit.h"
#include "mjit_unit.h"
#include "shape.h"
// Macros to check if a position is already compiled using compile_status.stack_size_for_pos
#define NOT_COMPILED_STACK_SIZE -1
#define ALREADY_COMPILED_P(status, pos) (status->stack_size_for_pos[pos] != NOT_COMPILED_STACK_SIZE)
// The unit structure that holds metadata of ISeq for MJIT.
struct rb_mjit_unit {
struct ccan_list_node unode;
// Unique order number of unit.
int id;
// Dlopen handle of the loaded object file.
void *handle;
rb_iseq_t *iseq;
#if defined(_WIN32)
// DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted.
char *so_file;
#endif
// Only used by unload_units. Flag to check this unit is currently on stack or not.
bool used_code_p;
// True if it's a unit for JIT compaction
bool compact_p;
// mjit_compile's optimization switches
struct rb_mjit_compile_info compile_info;
// captured CC values, they should be marked with iseq.
const struct rb_callcache **cc_entries;
unsigned int cc_entries_size; // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
};
// Storage to keep data which is consistent in each conditional branch.
// This is created and used for one `compile_insns` call and its values
// should be copied for extra `compile_insns` call.
@ -51,4 +74,4 @@ struct compile_status {
struct inlined_call_context inline_context;
};
#endif /* MJIT_COMPILER_H */
#endif /* MJIT_C_H */

View File

@ -1,29 +0,0 @@
#ifndef MJIT_UNIT_H
#define MJIT_UNIT_H
#include "ccan/list/list.h"
// The unit structure that holds metadata of ISeq for MJIT.
struct rb_mjit_unit {
struct ccan_list_node unode;
// Unique order number of unit.
int id;
// Dlopen handle of the loaded object file.
void *handle;
rb_iseq_t *iseq;
#if defined(_WIN32)
// DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted.
char *so_file;
#endif
// Only used by unload_units. Flag to check this unit is currently on stack or not.
bool used_code_p;
// True if it's a unit for JIT compaction
bool compact_p;
// mjit_compile's optimization switches
struct rb_mjit_compile_info compile_info;
// captured CC values, they should be marked with iseq.
const struct rb_callcache **cc_entries;
unsigned int cc_entries_size; // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs
};
#endif /* MJIT_UNIT_H */