Skip to content

Commit

Permalink
Merge branch 'master' into codedb-ffi-io
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckremes committed Mar 28, 2016
2 parents dbac57b + 7d071f0 commit 500878b
Show file tree
Hide file tree
Showing 85 changed files with 368 additions and 223 deletions.
1 change: 1 addition & 0 deletions core/rubinius.rb
Expand Up @@ -288,6 +288,7 @@ def self.version
end
end

extra << "C" if Rubinius::CONCURRENT_GC
extra << "D" if Rubinius::DEBUG_BUILD

rev = BUILD_REV[0..7]
Expand Down
2 changes: 1 addition & 1 deletion machine/builtin/block_environment.cpp
Expand Up @@ -22,7 +22,7 @@
#include "builtin/variable_scope.hpp"

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#include "jit/llvm/state.hpp"
#endif

#include <iostream>
Expand Down
3 changes: 3 additions & 0 deletions machine/builtin/code_db.cpp
Expand Up @@ -2,6 +2,7 @@

#include "memory.hpp"
#include "object_utils.hpp"
#include "on_stack.hpp"
#include "ontology.hpp"
#include "marshal.hpp"
#include "thread_phase.hpp"
Expand Down Expand Up @@ -130,6 +131,8 @@ namespace rubinius {
if(m_id.empty()) break;

CompiledCode* code = load(state, m_id.c_str());
OnStack<1> os(state, code);

if(code->nil_p()) {
Exception::raise_runtime_error(state, "unable to resolve method in CodeDB initialize");
}
Expand Down
6 changes: 3 additions & 3 deletions machine/builtin/compiled_code.cpp
Expand Up @@ -26,9 +26,9 @@
#include <ostream>

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#include "llvm/jit_compiler.hpp"
#include "llvm/jit_runtime.hpp"
#include "jit/llvm/state.hpp"
#include "jit/llvm/compiler.hpp"
#include "jit/llvm/runtime.hpp"
#endif

namespace rubinius {
Expand Down
2 changes: 1 addition & 1 deletion machine/builtin/jit.cpp
Expand Up @@ -6,7 +6,7 @@
#include "builtin/list.hpp"

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#include "jit/llvm/state.hpp"
#endif

namespace rubinius {
Expand Down
8 changes: 6 additions & 2 deletions machine/builtin/string.cpp
Expand Up @@ -768,8 +768,12 @@ namespace rubinius {
ascii_only(state, cFalse);
}

if(CBOOL(valid_encoding_) && !CBOOL(other->valid_encoding_p(state))) {
valid_encoding(state, cFalse);
if(!CBOOL(other->valid_encoding_p(state))) {
if(CBOOL(valid_encoding_)) {
valid_encoding(state, cFalse);
} else {
valid_encoding(state, cNil);
}
}

if(unlikely(length > data_length)) {
Expand Down
8 changes: 5 additions & 3 deletions machine/builtin/system.cpp
Expand Up @@ -65,9 +65,9 @@
#endif

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#include "llvm/jit_context.hpp"
#include "llvm/jit_compiler.hpp"
#include "jit/llvm/state.hpp"
#include "jit/llvm/context.hpp"
#include "jit/llvm/compiler.hpp"
#endif

#include "missing/setproctitle.h"
Expand Down Expand Up @@ -399,6 +399,7 @@ namespace rubinius {
int pid;

state->vm()->become_managed();
state->memory()->set_interrupt();

{
LockPhase locked(state);
Expand Down Expand Up @@ -830,6 +831,7 @@ namespace rubinius {
utilities::thread::SpinLock::LockGuard guard(state->shared().env()->fork_exec_lock());

state->shared().internal_threads()->before_fork(state);
state->memory()->set_interrupt();

LockPhase locked(state);

Expand Down
2 changes: 2 additions & 0 deletions machine/builtin/thread.cpp
Expand Up @@ -156,6 +156,7 @@ namespace rubinius {
call_frame->line(state));

if(!thread->send(state, state->symbol("initialize"), args, block, true)) {
thread->vm()->set_zombie(state);
return NULL;
}

Expand All @@ -175,6 +176,7 @@ namespace rubinius {
call_frame->line(state));

if(!thread->send(state, state->symbol("__thread_initialize__"), args, block, true)) {
thread->vm()->set_zombie(state);
return NULL;
}

Expand Down
21 changes: 14 additions & 7 deletions machine/bytecode_verification.cpp
Expand Up @@ -40,27 +40,27 @@ namespace rubinius {
if(Fixnum* fix = try_as<Fixnum>(method_->local_count())) {
locals_ = fix->to_native();
} else {
fail("method not initialized properly", -1);
fail("local_count is not a Fixnum", -1);
return false;
}

InstructionSequence* iseq = try_as<InstructionSequence>(method_->iseq());
if(!iseq) {
fail("method not initialized properly", -1);
fail("iseq is not an InstructionSequence", -1);
return false;
}

if(Tuple* tup = try_as<Tuple>(iseq->opcodes())) {
ops_ = tup;
} else {
fail("method not initialized properly", -1);
fail("opcodes is not a Tuple", -1);
return false;
}

if(Fixnum* fix = try_as<Fixnum>(method_->stack_size())) {
max_stack_allowed_ = fix->to_native();
} else {
fail("method not initialized properly", -1);
fail("stack_size is not a Fixnum", -1);
return false;
}

Expand All @@ -72,11 +72,18 @@ namespace rubinius {
}

Fixnum* tot = try_as<Fixnum>(method_->total_args());
if(!tot) {
fail("total_args is not a Fixnum", -1);
return false;
}
Fixnum* req = try_as<Fixnum>(method_->required_args());
if(!req) {
fail("required_args is not a Fixnum", -1);
return false;
}
Fixnum* post = try_as<Fixnum>(method_->post_args());

if(!tot || !req || !post) {
fail("method not initialized properly (missing arg counts)", -1);
if(!post) {
fail("post_args is not a Fixnum", -1);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion machine/call_frame.hpp
Expand Up @@ -12,7 +12,7 @@
#include <ostream>

#ifdef ENABLE_LLVM
#include "llvm/jit_runtime.hpp"
#include "jit/llvm/runtime.hpp"
#endif

namespace rubinius {
Expand Down
20 changes: 10 additions & 10 deletions machine/drivers/compile.cpp
Expand Up @@ -24,16 +24,16 @@
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/Bitcode/ReaderWriter.h>
#include <llvm/TypeSymbolTable.h>
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/LinkAllPasses.h"
#include "llvm/ModuleProvider.h"
#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/ExecutionEngine/Interpreter.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include <llvm/Analysis/Verifier.h>
#include <llvm/Analysis/LoopPass.h>
#include <llvm/Analysis/CallGraph.h>
#include <llvm/Target/TargetData.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/LinkAllPasses.h>
#include <llvm/ModuleProvider.h>
#include <llvm/ExecutionEngine/JIT.h>
#include <llvm/ExecutionEngine/Interpreter.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Target/TargetOptions.h>
#include <llvm/Transforms/Utils/Cloning.h>
Expand Down
6 changes: 3 additions & 3 deletions machine/environment.cpp
Expand Up @@ -25,7 +25,7 @@
#include "logger.hpp"

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#include "jit/llvm/state.hpp"
#if RBX_LLVM_API_VER == 208
#include <llvm/System/Threading.h>
#elif RBX_LLVM_API_VER == 209
Expand Down Expand Up @@ -585,6 +585,8 @@ namespace rubinius {

logger::write("exit process: %s %d", shared->pid.c_str(), exit_code);

shared->finalizer_handler()->finish(state);

state->shared().tool_broker()->shutdown(state);

if(Memory* om = state->memory()) {
Expand All @@ -602,8 +604,6 @@ namespace rubinius {

shared->thread_nexus()->wait_till_alone(state->vm());

shared->finalizer_handler()->finish(state);

NativeMethod::cleanup_thread(state);

state->shared().signals()->stop(state);
Expand Down
4 changes: 2 additions & 2 deletions machine/llvm/autotypes.cpp → machine/jit/llvm/autotypes.cpp
Expand Up @@ -40,9 +40,9 @@ namespace llvm {

namespace autogen_types {
#ifdef IS_64BIT_ARCH
#include "llvm/types64.cpp.gen"
#include "jit/llvm/types64.cpp.gen"
#else
#include "llvm/types32.cpp.gen"
#include "jit/llvm/types32.cpp.gen"
#endif
}

Expand Down
@@ -1,7 +1,7 @@
#ifndef VM_LLVM_BASIC_BLOCK_HPP
#define VM_LLVM_BASIC_BLOCK_HPP

#include "llvm/state.hpp"
#include "jit/llvm/state.hpp"

namespace rubinius {
struct JITBasicBlock {
Expand Down
6 changes: 3 additions & 3 deletions machine/llvm/jit_block.cpp → machine/jit/llvm/block.cpp
@@ -1,8 +1,8 @@
#ifdef ENABLE_LLVM

#include "llvm/jit_block.hpp"
#include "llvm/jit_context.hpp"
#include "llvm/method_info.hpp"
#include "jit/llvm/block.hpp"
#include "jit/llvm/context.hpp"
#include "jit/llvm/method_info.hpp"

#include "call_frame.hpp"
#include "stack_variables.hpp"
Expand Down
2 changes: 1 addition & 1 deletion machine/llvm/jit_block.hpp → machine/jit/llvm/block.hpp
@@ -1,4 +1,4 @@
#include "llvm/jit_builder.hpp"
#include "jit/llvm/builder.hpp"

namespace rubinius {
namespace jit {
Expand Down
10 changes: 5 additions & 5 deletions machine/llvm/jit_builder.cpp → machine/jit/llvm/builder.cpp
@@ -1,13 +1,13 @@
#ifdef ENABLE_LLVM

#include "llvm/jit_builder.hpp"
#include "jit/llvm/builder.hpp"
#include "call_frame.hpp"
#include "machine_code.hpp"

#include "llvm/jit_context.hpp"
#include "llvm/jit_visit.hpp"
#include "llvm/control_flow.hpp"
#include "llvm/cfg.hpp"
#include "jit/llvm/context.hpp"
#include "jit/llvm/visit.hpp"
#include "jit/llvm/control_flow.hpp"
#include "jit/llvm/cfg.hpp"

#include "instruments/tooling.hpp"
#include <llvm/Analysis/CaptureTracking.h>
Expand Down
8 changes: 4 additions & 4 deletions machine/llvm/jit_builder.hpp → machine/jit/llvm/builder.hpp
Expand Up @@ -4,10 +4,10 @@
#include "unwind_info.hpp"
#include "machine_code.hpp"

#include "llvm/jit_context.hpp"
#include "llvm/basic_block.hpp"
#include "llvm/inline_block.hpp"
#include "llvm/offset.hpp"
#include "jit/llvm/context.hpp"
#include "jit/llvm/basic_block.hpp"
#include "jit/llvm/inline_block.hpp"
#include "jit/llvm/offset.hpp"
#if RBX_LLVM_API_VER >= 303
#include <llvm/IR/IRBuilder.h>
#elif RBX_LLVM_API_VER >= 302
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions machine/llvm/jit_compiler.cpp → machine/jit/llvm/compiler.cpp
@@ -1,7 +1,7 @@
#ifdef ENABLE_LLVM

#include "machine_code.hpp"
#include "llvm/jit_context.hpp"
#include "jit/llvm/context.hpp"

#include "builtin/fixnum.hpp"
#include "builtin/constant_scope.hpp"
Expand Down Expand Up @@ -43,14 +43,14 @@

#include <sys/time.h>

#include "llvm/state.hpp"
#include "llvm/jit_compiler.hpp"
#include "llvm/jit_method.hpp"
#include "llvm/jit_block.hpp"
#include "jit/llvm/state.hpp"
#include "jit/llvm/compiler.hpp"
#include "jit/llvm/method.hpp"
#include "jit/llvm/block.hpp"

#include "llvm/method_info.hpp"
#include "jit/llvm/method_info.hpp"

#include "llvm/passes.hpp"
#include "jit/llvm/passes.hpp"
#include "instructions_util.hpp"
#include "dtrace/dtrace.h"

Expand Down
Expand Up @@ -3,7 +3,7 @@

#include <llvm/CodeGen/MachineCodeInfo.h>

#include "llvm/jit_context.hpp"
#include "jit/llvm/context.hpp"

namespace llvm {
class Function;
Expand Down
12 changes: 6 additions & 6 deletions machine/llvm/jit_context.cpp → machine/jit/llvm/context.cpp
@@ -1,11 +1,11 @@
#ifdef ENABLE_LLVM

#include "llvm/state.hpp"
#include "llvm/jit_context.hpp"
#include "llvm/jit_runtime.hpp"
#include "llvm/jit_memory_manager.hpp"
#include "llvm/passes.hpp"
#include "llvm/jit_builder.hpp"
#include "jit/llvm/state.hpp"
#include "jit/llvm/context.hpp"
#include "jit/llvm/runtime.hpp"
#include "jit/llvm/memory_manager.hpp"
#include "jit/llvm/passes.hpp"
#include "jit/llvm/builder.hpp"

#include "machine_code.hpp"

Expand Down
4 changes: 2 additions & 2 deletions machine/llvm/jit_context.hpp → machine/jit/llvm/context.hpp
Expand Up @@ -9,8 +9,8 @@
#include <llvm/LLVMContext.h>
#endif

#include "llvm/state.hpp"
#include "llvm/jit_memory_manager.hpp"
#include "jit/llvm/state.hpp"
#include "jit/llvm/memory_manager.hpp"

namespace rubinius {
class JITMethodInfo;
Expand Down
@@ -1,4 +1,4 @@
#include "llvm/opcode_iter.hpp"
#include "jit/llvm/opcode_iter.hpp"

#include <list>
#include <map>
Expand Down
Expand Up @@ -13,7 +13,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/detection.hpp"
#include "jit/llvm/detection.hpp"

//===----------------------------------------------------------------------===//
//
Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
#ifdef ENABLE_LLVM

#include "config.h"
#include "llvm/disassembler.hpp"
#include "jit/llvm/disassembler.hpp"
#include <llvm/Support/Host.h>
#if RBX_LLVM_API_VER >= 303
#include <llvm/IR/Instructions.h>
Expand Down