Fix Linux build problems.
authorDavid Anderson <dvander@alliedmods.net>
Sat Nov 17 19:07:49 2012 -0800 (2012-11-17)
changeset 1969904633b1dfc
parent 195 c1ba166f3fc4
child 197 f5a5a3926775
Fix Linux build problems.
src/AMBuild.library
src/Handles.h
src/Interpreter.cpp
src/NativeTable.cpp
src/NativeTable.h
src/compiler/AST.h
src/compiler/CompileContext.cpp
src/compiler/CompileContext.h
src/compiler/HIR.cpp
src/compiler/Scanner.cpp
src/compiler/Scanner.h
src/compiler/SemanticAnalysis.cpp
src/compiler/Symbols.cpp
src/compiler/Symbols.h
src/main.cpp
     1.1 --- a/src/AMBuild.library	Sat Nov 17 18:41:01 2012 -0800
     1.2 +++ b/src/AMBuild.library	Sat Nov 17 19:07:49 2012 -0800
     1.3 @@ -29,9 +29,15 @@
     1.4  	'API.cpp',
     1.5  	'Array.cpp',
     1.6  	'Box.cpp',
     1.7 -	'BytecodeCompiler.cpp',
     1.8 -	'BytecodeEmitter.cpp',
     1.9 -	'CompileContext.cpp',
    1.10 +	'compiler/BytecodeEmitter.cpp',
    1.11 +	'compiler/CompileContext.cpp',
    1.12 +	'compiler/HIR.cpp',
    1.13 +	'compiler/NameBinding.cpp',
    1.14 +	'compiler/Parser.cpp',
    1.15 +	'compiler/Scanner.cpp',
    1.16 +	'compiler/Scopes.cpp',
    1.17 +	'compiler/SemanticAnalysis.cpp',
    1.18 +	'compiler/Symbols.cpp',
    1.19  	'Environments.cpp',
    1.20  	'Exception.cpp',
    1.21  	'FixedArray.cpp',
    1.22 @@ -40,15 +46,11 @@
    1.23  	'Heap.cpp',
    1.24  	'Interpreter.cpp',
    1.25  	'Modules.cpp',
    1.26 -	'NameBinding.cpp',
    1.27 +	'NativeTable.cpp',
    1.28  	'Opcodes.cpp',
    1.29 -	'Parser.cpp',
    1.30  	'PoolAllocator.cpp',
    1.31  	'Reference.cpp',
    1.32  	'RootScopes.cpp',
    1.33 -	'Scanner.cpp',
    1.34 -	'Scopes.cpp',
    1.35 -	'SemanticAnalysis.cpp',
    1.36  	'Spaces.cpp',
    1.37  	'Stack.cpp',
    1.38  	'StringPool.cpp',
     2.1 --- a/src/Handles.h	Sat Nov 17 18:41:01 2012 -0800
     2.2 +++ b/src/Handles.h	Sat Nov 17 19:07:49 2012 -0800
     2.3 @@ -81,6 +81,11 @@
     2.4          return thingp_;
     2.5      }
     2.6  
     2.7 +    bool operator ==(const Handle<T> &other) const {
     2.8 +        return (!thingp_ && !other.thingp_) ||
     2.9 +               *thingp_ == *other.thingp_;
    2.10 +    }
    2.11 +
    2.12    private:
    2.13      template <typename S>
    2.14      void typeCheck() {
     3.1 --- a/src/Interpreter.cpp	Sat Nov 17 18:41:01 2012 -0800
     3.2 +++ b/src/Interpreter.cpp	Sat Nov 17 19:07:49 2012 -0800
     3.3 @@ -196,7 +196,7 @@
     3.4  }
     3.5  
     3.6  static void
     3.7 -GetField(Struct *obj, Descriptor *desc, LocalSlot *vp)
     3.8 +FetchField(Struct *obj, Descriptor *desc, LocalSlot *vp)
     3.9  {
    3.10      // :TODO: assert no GC.
    3.11      if (desc->type()->isTraceable()) {
    3.12 @@ -221,7 +221,7 @@
    3.13  {
    3.14      StructType *type = StructType::cast(obj->map()->type());
    3.15      Descriptor *desc = Descriptor::cast(type->fields()->at(index));
    3.16 -    GetField(obj, desc, vp);
    3.17 +    FetchField(obj, desc, vp);
    3.18  }
    3.19  
    3.20  static void
    3.21 @@ -229,11 +229,11 @@
    3.22  {
    3.23      Local<StructType> type(zone, StructType::cast(obj->map()->type()));
    3.24      Local<Descriptor> desc(zone, type->lookupField(name, NULL));
    3.25 -    GetField(obj, desc, vp);
    3.26 +    FetchField(obj, desc, vp);
    3.27  }
    3.28  
    3.29  static void
    3.30 -SetField(Zone *zone, Struct *obj, Descriptor *desc, const LocalSlot &v)
    3.31 +StoreField(Zone *zone, Struct *obj, Descriptor *desc, const LocalSlot &v)
    3.32  {
    3.33      // :TODO: assert no GC.
    3.34      if (desc->type()->isTraceable()) {
    3.35 @@ -258,7 +258,7 @@
    3.36  {
    3.37      StructType *type = StructType::cast(obj->map()->type());
    3.38      Descriptor *desc = Descriptor::cast(type->fields()->at(index));
    3.39 -    SetField(zone, obj, desc, v);
    3.40 +    StoreField(zone, obj, desc, v);
    3.41  }
    3.42  
    3.43  static void
    3.44 @@ -266,7 +266,7 @@
    3.45  {
    3.46      Local<StructType> type(zone, StructType::cast(obj->map()->type()));
    3.47      Local<Descriptor> desc(zone, type->lookupField(name, NULL));
    3.48 -    SetField(zone, obj, desc, v);
    3.49 +    StoreField(zone, obj, desc, v);
    3.50  }
    3.51  
    3.52  // Even though this function can fail, we immediately bail out, so it doesn't
    3.53 @@ -285,13 +285,13 @@
    3.54          Descriptor *desc = Descriptor::cast(type->fields()->at(i));
    3.55  
    3.56          LocalSlot rval;
    3.57 -        GetField(right, desc, &rval);
    3.58 +        FetchField(right, desc, &rval);
    3.59  
    3.60          // If the field is a struct, we need to deep-copy.
    3.61          if (desc->type()->isStruct()) {
    3.62              LocalSlot lval;
    3.63  
    3.64 -            GetField(left, desc, &lval);
    3.65 +            FetchField(left, desc, &lval);
    3.66              leftStruct = Struct::cast(lval.obj);
    3.67              rightStruct = Struct::cast(rval.obj);
    3.68              if (!CopyStruct(zone, leftStruct, rightStruct))
    3.69 @@ -299,13 +299,13 @@
    3.70          } else if (desc->type()->isArray()) {
    3.71              LocalSlot lval;
    3.72  
    3.73 -            GetField(left, desc, &lval);
    3.74 +            FetchField(left, desc, &lval);
    3.75              leftArray = Array::cast(lval.obj);
    3.76              rightArray = Array::cast(rval.obj);
    3.77              if (!CopyArray(zone, leftArray, rightArray))
    3.78                  return false;
    3.79          } else {
    3.80 -            SetField(zone, left, desc, rval);
    3.81 +            StoreField(zone, left, desc, rval);
    3.82          }
    3.83      }
    3.84  
     4.1 --- a/src/NativeTable.cpp	Sat Nov 17 18:41:01 2012 -0800
     4.2 +++ b/src/NativeTable.cpp	Sat Nov 17 19:07:49 2012 -0800
     4.3 @@ -19,6 +19,7 @@
     4.4  #include "Zone.h"
     4.5  #include "NativeTable.h"
     4.6  #include "StringPool.h"
     4.7 +#include "Heap-inl.h"
     4.8  
     4.9  using namespace ke;
    4.10  
     5.1 --- a/src/NativeTable.h	Sat Nov 17 18:41:01 2012 -0800
     5.2 +++ b/src/NativeTable.h	Sat Nov 17 19:07:49 2012 -0800
     5.3 @@ -19,6 +19,7 @@
     5.4  #ifndef _include_sp2_native_table_h_
     5.5  #define _include_sp2_native_table_h_
     5.6  
     5.7 +#include <string.h>
     5.8  #include "AllocatorPolicies.h"
     5.9  #include "Strings.h"
    5.10  #include "HashTable.h"
     6.1 --- a/src/compiler/AST.h	Sat Nov 17 18:41:01 2012 -0800
     6.2 +++ b/src/compiler/AST.h	Sat Nov 17 19:07:49 2012 -0800
     6.3 @@ -887,8 +887,8 @@
     6.4      EnumStatement(const SourcePosition &pos, Handle<String> name, EntryList *entries)
     6.5        : Statement(pos),
     6.6          name_(name),
     6.7 -        entries_(entries),
     6.8 -        sym_(NULL)
     6.9 +        sym_(NULL),
    6.10 +        entries_(entries)
    6.11      {
    6.12      }
    6.13  
     7.1 --- a/src/compiler/CompileContext.cpp	Sat Nov 17 18:41:01 2012 -0800
     7.2 +++ b/src/compiler/CompileContext.cpp	Sat Nov 17 19:07:49 2012 -0800
     7.3 @@ -97,7 +97,7 @@
     7.4      assert(!unit->tree_);
     7.5  
     7.6      size_t length;
     7.7 -    char *source = loadSource(unit->path_.c_str(), &length);
     7.8 +    char *source = loadSource(unit->path_, &length);
     7.9      if (!source)
    7.10          return false;
    7.11  
     8.1 --- a/src/compiler/CompileContext.h	Sat Nov 17 18:41:01 2012 -0800
     8.2 +++ b/src/compiler/CompileContext.h	Sat Nov 17 19:07:49 2012 -0800
     8.3 @@ -47,7 +47,7 @@
     8.4      }
     8.5  
     8.6      ParseTree *tree_;
     8.7 -    std::string path_;
     8.8 +    const char *path_;
     8.9      bool failed_;
    8.10      PoolList<TranslationUnit *> dependents_;
    8.11      ImportScope *importScope_;
     9.1 --- a/src/compiler/HIR.cpp	Sat Nov 17 18:41:01 2012 -0800
     9.2 +++ b/src/compiler/HIR.cpp	Sat Nov 17 19:07:49 2012 -0800
     9.3 @@ -18,6 +18,8 @@
     9.4   */
     9.5  #include "HIR.h"
     9.6  #include "BytecodeEmitter.h"
     9.7 +#include "../Heap-inl.h"
     9.8 +#include "../Handles-inl.h"
     9.9  
    9.10  using namespace ke;
    9.11  
    10.1 --- a/src/compiler/Scanner.cpp	Sat Nov 17 18:41:01 2012 -0800
    10.2 +++ b/src/compiler/Scanner.cpp	Sat Nov 17 19:07:49 2012 -0800
    10.3 @@ -22,6 +22,7 @@
    10.4  #include <limits.h>
    10.5  #include <string.h>
    10.6  #include "../Utility.h"
    10.7 +#include "../Heap-inl.h"
    10.8  #include "Scanner.h"
    10.9  
   10.10  using namespace ke;
    11.1 --- a/src/compiler/Scanner.h	Sat Nov 17 18:41:01 2012 -0800
    11.2 +++ b/src/compiler/Scanner.h	Sat Nov 17 19:07:49 2012 -0800
    11.3 @@ -19,7 +19,6 @@
    11.4  #ifndef _include_jitcraft_scanner_h_
    11.5  #define _include_jitcraft_scanner_h_
    11.6  
    11.7 -#include <string>
    11.8  #include "Token.h"
    11.9  #include "CompileContext.h"
   11.10  #include "../Opcodes.h"
    12.1 --- a/src/compiler/SemanticAnalysis.cpp	Sat Nov 17 18:41:01 2012 -0800
    12.2 +++ b/src/compiler/SemanticAnalysis.cpp	Sat Nov 17 19:07:49 2012 -0800
    12.3 @@ -24,6 +24,7 @@
    12.4  #include "../Modules.h"
    12.5  #include "../Code.h"
    12.6  #include "SemanticAnalysis.h"
    12.7 +#include "../Heap-inl.h"
    12.8  
    12.9  using namespace ke;
   12.10  
    13.1 --- a/src/compiler/Symbols.cpp	Sat Nov 17 18:41:01 2012 -0800
    13.2 +++ b/src/compiler/Symbols.cpp	Sat Nov 17 19:07:49 2012 -0800
    13.3 @@ -17,4 +17,6 @@
    13.4   * JITCraft. If not, see http://www.gnu.org/licenses/.
    13.5   */
    13.6  #include "Symbols.h"
    13.7 +#include "../Heap-inl.h"
    13.8 +#include "../Handles-inl.h"
    13.9  
    14.1 --- a/src/compiler/Symbols.h	Sat Nov 17 18:41:01 2012 -0800
    14.2 +++ b/src/compiler/Symbols.h	Sat Nov 17 19:07:49 2012 -0800
    14.3 @@ -23,6 +23,7 @@
    14.4  #include "../Handles.h"
    14.5  #include "../Opcodes.h"
    14.6  #include "../Types.h"
    14.7 +#include "../Strings.h"
    14.8  
    14.9  namespace ke {
   14.10  
    15.1 --- a/src/main.cpp	Sat Nov 17 18:41:01 2012 -0800
    15.2 +++ b/src/main.cpp	Sat Nov 17 19:07:49 2012 -0800
    15.3 @@ -119,9 +119,9 @@
    15.4  
    15.5          Keima::CollectGarbage();
    15.6  
    15.7 -        Keima::BindNative("PrintFloat", PrintFloat);
    15.8 -        Keima::BindNative("PrintNum", PrintNum);
    15.9 -        Keima::BindNative("PrintString", PrintString);
   15.10 +        Keima::BindNative("PrintFloat", (void *)PrintFloat);
   15.11 +        Keima::BindNative("PrintNum", (void *)PrintNum);
   15.12 +        Keima::BindNative("PrintString", (void *)PrintString);
   15.13  
   15.14          Handle<Function> fun = entry.fun();
   15.15