Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from mgaudet/rubyomr_preview_publish
Browse files Browse the repository at this point in the history
Merge Ruby JIT glue, and update repository contents.
  • Loading branch information
mstoodle committed Sep 27, 2016
2 parents 67a0ac4 + 3aca5b3 commit 448a91d
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 374 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -1,3 +1,6 @@
[submodule "omr"]
path = omr
url = https://github.com/eclipse/omr.git
[submodule "rbjitglue"]
path = rbjitglue
url = https://github.com/rubyomr-preview/rbjitglue.git
19 changes: 11 additions & 8 deletions Makefile.in
Expand Up @@ -254,10 +254,13 @@ WITH_OMR_JIT= @WITH_OMR_JIT@

ifdef WITH_OMR_JIT

TRSRC?=@TRSRC@
export TRSRC
RBJITGLUE_DIR?=@RBJITGLUE_DIR@
RELATIVE_OMR_DIR?=@RELATIVE_OMR_DIR@
export RBJITGLUE_DIR
export RELATIVE_OMR_DIR
JIT_SO_NAME="librbjit.so"
JIT_SO_DIR="$(CURDIR)"
all_omr_configure_args += --enable-OMR_JIT

endif # WITH_OMR_JIT

Expand Down Expand Up @@ -294,7 +297,6 @@ postbuild: jit
install: jit-install
uninstall: jit-uninstall
clean: jit-clean
endif

omr-configure:
$(MAKE) -C $(OMRDIR) -f run_configure.mk SPEC="$(SPEC)" OMRGLUE="$(OMRGLUEDIR)" OMRGLUE_INCLUDES="$(RUBY_IPATH)" OMRGLUE_CXXFLAGS="-Wno-error" OMRGLUE_CFLAGS="-Wno-error" EXTRA_CONFIGURE_ARGS="$(all_omr_configure_args)"
Expand All @@ -316,9 +318,9 @@ JIT_PARAOPT ?= -j4

jit: jit-prod
jit-prod:
nice $(MAKE) $(JIT_PARAOPT) -C $(TRSRC)/ruby RUBY_IPATH="$(RUBY_IPATH) $(OMR_IPATH) $(OMRGLUE_IPATH)" JIT_DLL_DIR="$(JIT_SO_DIR)" BUILD_CONFIG=prod OMR_RUBY_INSTALL=$(OMRDIR)/../
nice $(MAKE) $(JIT_PARAOPT) -C $(RBJITGLUE_DIR)/ruby RUBY_DIR=$(abs_srcdir) RELATIVE_OMR_DIR=$(RELATIVE_OMR_DIR) RBJITGLUE_DIR=$(RBJITGLUE_DIR) RUBY_IPATH="$(RUBY_IPATH) $(OMR_IPATH) $(OMRGLUE_IPATH)" JIT_DLL_DIR="$(JIT_SO_DIR)" BUILD_CONFIG=prod
jit-debug:
nice $(MAKE) $(JIT_PARAOPT) -C $(TRSRC)/ruby RUBY_IPATH="$(RUBY_IPATH) $(OMR_IPATH) $(OMRGLUE_IPATH)" JIT_DLL_DIR="$(JIT_SO_DIR)" BUILD_CONFIG=debug OMR_RUBY_INSTALL=$(OMRDIR)/../
nice $(MAKE) $(JIT_PARAOPT) -C $(RBJITGLUE_DIR)/ruby RUBY_DIR=$(abs_srcdir) RELATIVE_OMR_DIR=$(RELATIVE_OMR_DIR) RBJITGLUE_DIR=$(RBJITGLUE_DIR) RUBY_IPATH="$(RUBY_IPATH) $(OMR_IPATH) $(OMRGLUE_IPATH)" JIT_DLL_DIR="$(JIT_SO_DIR)" BUILD_CONFIG=debug

jit-install: jit
$(INSTALL) -D $(JIT_SO_DIR)/$(JIT_SO_NAME) $(DESTDIR)$(libdir)/$(JIT_SO_NAME)
Expand All @@ -327,10 +329,12 @@ jit-uninstall:
$(RM) $(DESTDIR)$(libdir)/$(JIT_SO_NAME)

jit-clean:
$(MAKE) -C $(TRSRC)/ruby JIT_DLL_DIR="$(JIT_SO_DIR)" OMR_RUBY_INSTALL=$(OMRDIR)/../ clean
$(MAKE) -C $(RBJITGLUE_DIR)/ruby RUBY_DIR=$(srcdir) REALTIVE_OMR_DIR=$(OMR_DIR) RBJITGLUE_DIR=$(RBJITGLUE_DIR) JIT_DLL_DIR="$(JIT_SO_DIR)" clean

.PHONY: jit jit-only jit-install jit-clean

endif

ifdef WITH_OMR_HEALTHCENTER
install: hc-install
uninstall: hc-uninstall
Expand Down Expand Up @@ -363,7 +367,6 @@ $(PROGRAM):
@$(RM) $@
$(ECHO) linking $@
$(Q) $(PURIFY) $(CXX) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
$(Q) $(POSTLINK)

# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
Expand Down Expand Up @@ -660,4 +663,4 @@ verconf.h: $(RBCONFIG)
loadpath: verconf.h
@$(CPP) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/loadpath.c | \
sed -e '1,/^const char ruby_initial_load_paths/d;/;/,$$d' \
-e '/^ /!d;s/ *"\\0"$$//;s/" *"//g'
-e '/^ /!d;s/ *"\\0"$$//;s/" *"//g'
3 changes: 3 additions & 0 deletions README.md
@@ -1,3 +1,6 @@
This branch contains a modified version of the Ruby VM that builds the
[Ruby + OMR Technology Preview](https://github.com/rubyomr-preview/rubyomr-preview).

# What's Ruby

Ruby is the interpreted scripting language for quick and easy object-oriented
Expand Down
30 changes: 19 additions & 11 deletions configure.in
Expand Up @@ -549,8 +549,11 @@ AS_IF([test "x$enable_omr_object_table" != "xno"],
# OMR JIT Configuration
AC_MSG_CHECKING([for --with-omr-jit])

AC_ARG_VAR([TRSRC],
[path to Testarossa source code. defaults to $srcdir/../tr.source.])
AC_ARG_VAR([RBJITGLUE_DIR],
[path to Ruby JIT glue code. defaults to rbjitglue])

AC_ARG_VAR([RELATIVE_OMR_DIR],
[path to omr component Relative to VM, defaults to omr])

AC_ARG_WITH([omr-jit],
[AS_HELP_STRING([--with-omr-jit],
Expand All @@ -564,25 +567,30 @@ AS_IF([test "x$with_omr_jit" = "xyes"],
[
WITH_OMR_JIT=$with_omr_jit

#Define OMR_JIT in config.h
AC_DEFINE(OMR_JIT)
AC_DEFINE(JIT_INTERFACE)
AC_DEFINE(RUBY_SEND_WITHOUT_BLOCK)
#g The OMR GC provides OMR_RUBY_VALID_CLASS
AC_DEFINE(OMR_RUBY_VALID_CLASS)

# If TRSRC isn't defined, set to default
AS_IF([test "x$TRSRC" = "x"],
[TRSRC="$srcdir/../tr.source"],
# If RBJITGLUE_DIR isn't defined, set to default
AS_IF([test "x$RBJITGLUE_DIR" = "x"],
[RBJITGLUE_DIR="rbjitglue"],
[])

OMR_ABS_PATH(TRSRC, $TRSRC)
AS_IF([test "x$RELATIVE_OMR_DIR" = "x"],
[RELATIVE_OMR_DIR="omr"],
[])


AC_MSG_RESULT([yes: TRSRC=$TRSRC])
AC_MSG_RESULT([yes: RBJITGLUE_DIR=$RBJITGLUE_DIR RELATIVE_OMR_DIR=$RELATIVE_OMR_DIR])

AS_IF([test -d "$RBJITGLUE_DIR/ruby/build"],
[],
[AC_MSG_ERROR([RBJITGLUE_DIR misconfigured, cannot find directory $RBJITGLUE_DIR/build])])

AS_IF([test -d "$TRSRC/ibm/codegen"],
AS_IF([test -d "$RELATIVE_OMR_DIR/compiler"],
[],
[AC_MSG_ERROR([TRSRC misconfigured, cannot find directory $TRSRC/ibm/codegen])])
[AC_MSG_ERROR([RELATIVE_OMR_DIR misconfigured, cannot find directory $RELATIVE_OMR_DIR/compiler])])

],
[AC_MSG_RESULT([no])])
Expand Down
1 change: 1 addition & 0 deletions include/ruby/defines.h
Expand Up @@ -308,6 +308,7 @@ void rb_ia64_flushrs(void);
#ifndef UNALIGNED_WORD_ACCESS
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
defined(__s390x__) || defined(__s390__) || \
defined(__powerpc64__) || \
defined(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
Expand Down
13 changes: 13 additions & 0 deletions jit.h
Expand Up @@ -88,6 +88,10 @@ struct jit_callbacks_struct {

typedef struct jit_callbacks_struct jit_callbacks_t;

typedef enum jit_options_bits {
TIERED_COMPILATION = 0x1,
CODE_CACHE_RECLAMATION = 0x2,
} jit_options_bits;

/**
* This struct contains pointers to various global variables
Expand Down Expand Up @@ -122,6 +126,15 @@ struct rb_jit_struct {
/** Default compilation count. */
int default_count;

/** Tiered compilation. */
int tiered_compilation;

/** temporary flag for ruby recompilation */
int ruby_recomp_available;

/** Used for options bits */
long options;

/*
* vm->jit interface
*/
Expand Down
2 changes: 1 addition & 1 deletion omr
Submodule omr updated 1666 files
1 change: 1 addition & 0 deletions omrglue/CollectorLanguageInterfaceImpl.hpp
Expand Up @@ -169,6 +169,7 @@ class MM_CollectorLanguageInterfaceImpl : public MM_CollectorLanguageInterface {

virtual void workPacketOverflow_overflowItem(MM_EnvironmentBase *env, omrobjectptr_t objectPtr) {}

virtual void generationalWriteBarrierStore(OMR_VMThread *omrThread, omrobjectptr_t parentObject, fomrobject_t *parentSlot, omrobjectptr_t childObject) {}
#if defined(OMR_GC_MODRON_SCAVENGER)
virtual void scavenger_reportObjectEvents(MM_EnvironmentBase *env);
virtual void scavenger_masterSetupForGC(MM_EnvironmentBase *env);
Expand Down

0 comments on commit 448a91d

Please sign in to comment.