Updating the compiler to use the new-world model
New compiler is integrated and passes first test (Fibonacci).
Change-Id: Ic5448ab89ebd22baa30fafc3d1300324687d1fc2
diff --git a/src/utils.cc b/src/utils.cc
index 67d5780..f8a55ce 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -1,11 +1,30 @@
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: enh@google.com (Elliott Hughes)
+#include "file.h"
#include "object.h"
+#include "os.h"
#include "utils.h"
namespace art {
+std::string ReadFileToString(const char* file_name) {
+ scoped_ptr<File> file(OS::OpenFile(file_name, false));
+ CHECK(file != NULL);
+
+ std::string contents;
+ char buf[8 * KB];
+ while (true) {
+ int64_t n = file->Read(buf, sizeof(buf));
+ CHECK_NE(-1, n);
+ if (n == 0) {
+ break;
+ }
+ contents.append(buf, n);
+ }
+ return contents;
+}
+
std::string PrettyDescriptor(const StringPiece& descriptor) {
// Count the number of '['s to get the dimensionality.
const char* c = descriptor.data();