Skip to content

Commit

Permalink
Showing 5 changed files with 98 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ci.hocon
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ common: {

setup: ${common-setup}

timelimit: "00:30:00"
timelimit: "00:60:00"
}

no-graal: {
85 changes: 85 additions & 0 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*
* This file contains code that is based on the Ruby API headers,
* copyright (C) Yukihiro Matsumoto, licensed under the 2-clause BSD licence
* as described in the file BSDL included with JRuby+Truffle.
*/

#ifndef TRUFFLE_RUBY_H
@@ -39,6 +43,87 @@ typedef void* VALUE;

#define NORETURN(X) __attribute__((__noreturn__)) X

// Types

enum ruby_value_type {
RUBY_T_NONE = 0x00,

RUBY_T_OBJECT = 0x01,
RUBY_T_CLASS = 0x02,
RUBY_T_MODULE = 0x03,
RUBY_T_FLOAT = 0x04,
RUBY_T_STRING = 0x05,
RUBY_T_REGEXP = 0x06,
RUBY_T_ARRAY = 0x07,
RUBY_T_HASH = 0x08,
RUBY_T_STRUCT = 0x09,
RUBY_T_BIGNUM = 0x0a,
RUBY_T_FILE = 0x0b,
RUBY_T_DATA = 0x0c,
RUBY_T_MATCH = 0x0d,
RUBY_T_COMPLEX = 0x0e,
RUBY_T_RATIONAL = 0x0f,

RUBY_T_NIL = 0x11,
RUBY_T_TRUE = 0x12,
RUBY_T_FALSE = 0x13,
RUBY_T_SYMBOL = 0x14,
RUBY_T_FIXNUM = 0x15,
RUBY_T_UNDEF = 0x16,

RUBY_T_IMEMO = 0x1a,
RUBY_T_NODE = 0x1b,
RUBY_T_ICLASS = 0x1c,
RUBY_T_ZOMBIE = 0x1d,

RUBY_T_MASK = 0x1f
};

#define T_NONE RUBY_T_NONE
#define T_NIL RUBY_T_NIL
#define T_OBJECT RUBY_T_OBJECT
#define T_CLASS RUBY_T_CLASS
#define T_ICLASS RUBY_T_ICLASS
#define T_MODULE RUBY_T_MODULE
#define T_FLOAT RUBY_T_FLOAT
#define T_STRING RUBY_T_STRING
#define T_REGEXP RUBY_T_REGEXP
#define T_ARRAY RUBY_T_ARRAY
#define T_HASH RUBY_T_HASH
#define T_STRUCT RUBY_T_STRUCT
#define T_BIGNUM RUBY_T_BIGNUM
#define T_FILE RUBY_T_FILE
#define T_FIXNUM RUBY_T_FIXNUM
#define T_TRUE RUBY_T_TRUE
#define T_FALSE RUBY_T_FALSE
#define T_DATA RUBY_T_DATA
#define T_MATCH RUBY_T_MATCH
#define T_SYMBOL RUBY_T_SYMBOL
#define T_RATIONAL RUBY_T_RATIONAL
#define T_COMPLEX RUBY_T_COMPLEX
#define T_IMEMO RUBY_T_IMEMO
#define T_UNDEF RUBY_T_UNDEF
#define T_NODE RUBY_T_NODE
#define T_ZOMBIE RUBY_T_ZOMBIE
#define T_MASK RUBY_T_MASK

typedef struct rb_data_type_struct rb_data_type_t;

struct rb_data_type_struct {
const char *wrap_struct_name;

struct {
void (*dmark)(void *);
void (*dfree)(void *);
size_t (*dsize)(const void *);
void *reserved[2];
} function;

const rb_data_type_t *parent;
void *data;
VALUE flags;
};

// Constants

VALUE get_Qfalse(void);
6 changes: 5 additions & 1 deletion lib/ruby/truffle/cext/version.h
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*
* This file contains code that is based on the Ruby API headers,
* copyright (C) Yukihiro Matsumoto, licensed under the 2-clause BSD licence
* as described in the file BSDL included with JRuby+Truffle.
*/

#ifndef TRUFFLE_VERSION_H
@@ -17,4 +21,4 @@
#define RUBY_API_VERSION_TEENY 0
#define RUBY_API_VERSION_CODE (RUBY_API_VERSION_MAJOR*10000+RUBY_API_VERSION_MINOR*100+RUBY_API_VERSION_TEENY)

#endif
#endif
6 changes: 3 additions & 3 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -502,9 +502,9 @@ def build(*options)
openssl_home = ENV['OPENSSL_HOME'] || '/usr'

unless no_openssl
#cextc "#{JRUBY_DIR}/truffle/src/main/c/openssl",
# '-DRUBY_EXTCONF_H="extconf.h"',
# '-Werror=implicit-function-declaration'
cextc "#{JRUBY_DIR}/truffle/src/main/c/openssl",
'-DRUBY_EXTCONF_H="extconf.h"',
'-Werror=implicit-function-declaration'
end
when nil
mvn env, *maven_options, 'package'
4 changes: 4 additions & 0 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*
* This file contains code that is based on the Ruby API headers,
* copyright (C) Yukihiro Matsumoto, licensed under the 2-clause BSD licence
* as described in the file BSDL included with JRuby+Truffle.
*/

#include <truffle.h>

0 comments on commit b765f65

Please sign in to comment.