Skip to content
Browse files

Abstract use of tr1 a bit more.

  • Loading branch information...
1 parent 40ce177 commit 66d9b36a61129f460566461ce83fffb04fe81cb9 @brixen brixen committed Jun 12, 2013
Showing with 68 additions and 15 deletions.
  1. +25 −1 configure
  2. +2 −2 vm/agent_components.cpp
  3. +2 −2 vm/fiber_stack.hpp
  4. +2 −3 vm/global_cache.hpp
  5. +14 −0 vm/missing/unordered_map.hpp
  6. +14 −0 vm/missing/unordered_set.hpp
  7. +6 −5 vm/shared_state.hpp
  8. +3 −2 vm/symboltable.hpp
View
26 configure
@@ -1039,8 +1039,27 @@ int main() { return sizeof(#{type}); }
@log.write @little_endian ? "little endian" : "big endian"
end
+ def detect_tr1
+ @log.print "Checking for tr1: "
+
+ status = check_program(false) do |f|
+ src = <<-EOP
+#include <tr1/unordered_map>
+
+typedef std::tr1::unordered_map<int, void*> X;
+
+int main() { X x; return 0; }
+ EOP
+ f.puts src
+ @log.log src
+ end
+
+ @tr1 = (status == 0)
+ @log.write @tr1 ? "found" : "not found"
+ end
+
def detect_tr1_hash
- @log.print "Checking tr1/hash definition: "
+ @log.print "Checking for tr1/hash definition: "
status = check_program(false) do |f|
src = <<-EOP
@@ -1444,6 +1463,7 @@ int main() { return tgetnum(""); }
detect_libc_name
detect_endian
+ detect_tr1
detect_tr1_hash
detect_x86
detect_features
@@ -1683,6 +1703,10 @@ end
f.puts "#define RBX_LITTLE_ENDIAN 1"
end
+ if @tr1
+ f.puts "#define RBX_HAVE_TR1 1"
+ end
+
if @tr1_hash
f.puts "#define RBX_HAVE_TR1_HASH 1"
end
View
4 vm/agent_components.cpp
@@ -1,4 +1,4 @@
-#include <tr1/unordered_map>
+#include "missing/unordered_map.hpp"
#include "config.h"
@@ -66,7 +66,7 @@ namespace agent {
}
};
- typedef std::tr1::unordered_map<std::string, Item*> NamedItems;
+ typedef std_unordered_map<std::string, Item*> NamedItems;
class DynamicVariable : public Item {
public:
View
4 vm/fiber_stack.hpp
@@ -1,7 +1,7 @@
#ifndef RBX_VM_FIBER_STACK_HPP
#define RBX_VM_FIBER_STACK_HPP
-#include <tr1/unordered_set>
+#include "missing/unordered_set.hpp"
#include "util/thread.hpp"
namespace rubinius {
@@ -72,7 +72,7 @@ namespace rubinius {
private:
typedef std::list<FiberStack> Stacks;
- typedef std::tr1::unordered_set<FiberData*> Datas;
+ typedef std_unordered_set<FiberData*> Datas;
size_t max_stacks_;
size_t stack_size_;
View
5 vm/global_cache.hpp
@@ -6,8 +6,7 @@
#include "builtin/compiledcode.hpp"
#include "builtin/symbol.hpp"
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
+#include "missing/unordered_set.hpp"
namespace rubinius {
#define CPU_CACHE_SIZE 0x1000
@@ -17,7 +16,7 @@ namespace rubinius {
struct LookupData;
class Dispatch;
- typedef std::tr1::unordered_set<native_int> SeenMethodSet;
+ typedef std_unordered_set<native_int> SeenMethodSet;
class GlobalCache : public Lockable {
public:
View
14 vm/missing/unordered_map.hpp
@@ -0,0 +1,14 @@
+#ifndef RBX_MISSING_UNORDERED_MAP_HPP
+#define RBX_MISSING_UNORDERED_MAP_HPP
+
+#include "vm/config.h"
+
+#ifdef RBX_HAVE_TR1
+#include <tr1/unordered_map>
+#define std_unordered_map std::tr1::unordered_map
+#else
+#include <unordered_map>
+#define std_unordered_map std::unordered_map
+#endif
+
+#endif
View
14 vm/missing/unordered_set.hpp
@@ -0,0 +1,14 @@
+#ifndef RBX_MISSING_UNORDERED_SET_HPP
+#define RBX_MISSING_UNORDERED_SET_HPP
+
+#include "vm/config.h"
+
+#ifdef RBX_HAVE_TR1
+#include <tr1/unordered_set>
+#define std_unordered_set std::tr1::unordered_set
+#else
+#include <unordered_set>
+#define std_unordered_set std::unordered_set
+#endif
+
+#endif
View
11 vm/shared_state.hpp
@@ -23,8 +23,9 @@
#include "capi/capi_constants.h"
#include <vector>
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
+
+#include "missing/unordered_map.hpp"
+#include "missing/unordered_set.hpp"
#ifdef RBX_WINDOWS
#include <winsock2.h>
@@ -55,12 +56,12 @@ namespace rubinius {
class QueryAgent;
class Environment;
- typedef std::tr1::unordered_set<std::string> CApiBlackList;
+ typedef std_unordered_set<std::string> CApiBlackList;
typedef std::vector<Mutex*> CApiLocks;
- typedef std::tr1::unordered_map<std::string, int> CApiLockMap;
+ typedef std_unordered_map<std::string, int> CApiLockMap;
typedef std::vector<std::string> CApiConstantNameMap;
- typedef std::tr1::unordered_map<int, capi::Handle*> CApiConstantHandleMap;
+ typedef std_unordered_map<int, capi::Handle*> CApiConstantHandleMap;
/**
* SharedState represents the global shared state that needs to be shared
View
5 vm/symboltable.hpp
@@ -7,7 +7,8 @@
#include <string>
#include <vector>
-#include <tr1/unordered_map>
+
+#include "missing/unordered_map.hpp"
/* SymbolTable provides a one-to-one map between a symbol ID
* and a string. The hashing algorithm used to generate a
@@ -33,7 +34,7 @@ namespace rubinius {
typedef std::vector<std::string> SymbolStrings;
typedef std::vector<std::size_t> SymbolIds;
- typedef std::tr1::unordered_map<hashval, SymbolIds> SymbolMap;
+ typedef std_unordered_map<hashval, SymbolIds> SymbolMap;
class SymbolTable {
public: // Types

0 comments on commit 66d9b36

Please sign in to comment.
Something went wrong with that request. Please try again.