]> git.mdlowis.com Git - archive/atc.git/commitdiff
Initial commit
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 29 Mar 2015 01:16:48 +0000 (21:16 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 29 Mar 2015 01:16:48 +0000 (21:16 -0400)
.gitmodules [new file with mode: 0644]
Gemfile [new file with mode: 0644]
Gemfile.lock [new file with mode: 0644]
build.rb [new file with mode: 0755]
modules/build-system [new submodule]
source/runtime/gc.c [new file with mode: 0644]
source/runtime/gc.h [new file with mode: 0644]
source/runtime/main.c [new file with mode: 0644]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..234e012
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "modules/build-system"]
+       path = modules/build-system
+       url = https://github.com/mikedlowis/build-system.git
diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
index 0000000..894906d
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+gem 'rake', '>= 0'
+gem 'rscons', '>= 0'
+gem 'rspec', '>= 0'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644 (file)
index 0000000..22e438c
--- /dev/null
@@ -0,0 +1,28 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    diff-lcs (1.2.5)
+    json (1.8.1)
+    rake (10.3.2)
+    rscons (1.8.1)
+      json (~> 1.0)
+    rspec (3.1.0)
+      rspec-core (~> 3.1.0)
+      rspec-expectations (~> 3.1.0)
+      rspec-mocks (~> 3.1.0)
+    rspec-core (3.1.7)
+      rspec-support (~> 3.1.0)
+    rspec-expectations (3.1.2)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.1.0)
+    rspec-mocks (3.1.3)
+      rspec-support (~> 3.1.0)
+    rspec-support (3.1.2)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  rake
+  rscons
+  rspec
diff --git a/build.rb b/build.rb
new file mode 100755 (executable)
index 0000000..da49bfb
--- /dev/null
+++ b/build.rb
@@ -0,0 +1,28 @@
+#!/usr/bin/ruby
+
+require_relative 'modules/build-system/setup'
+
+#------------------------------------------------------------------------------
+# Environment Definitions
+#------------------------------------------------------------------------------
+# Define the default compiler environment
+base_env = BuildEnv.new do |env|
+  # Move the object files to the build dir
+  env.build_dir('source','build/obj/source')
+end
+
+#------------------------------------------------------------------------------
+# Release Build Targets
+#------------------------------------------------------------------------------
+base_env.Library('build/libatc.a', Dir['source/runtime/*.c'])
+
+#------------------------------------------------------------------------------
+# Test Build Targets
+#------------------------------------------------------------------------------
+#if Opts[:profile].include? "test"
+#  compiler_libs = ['build/lib/libparse-test.a'] + runtime_libs
+#  test_env.Library('build/lib/libparse-test.a', FileList['source/libparse/*.c'])
+#  test_env.Program('build/bin/sclpl-test', FileList['source/sclpl/*.c'] + compiler_libs)
+#  test_env.Command('RSpec', [], 'CMD' => [
+#      'rspec', '--pattern', 'spec/**{,/*/**}/*_spec.rb', '--format', 'documentation'])
+#end
diff --git a/modules/build-system b/modules/build-system
new file mode 160000 (submodule)
index 0000000..f1a522b
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f1a522b4aed7c58ce3c8467ff8a00f00c3e27e64
diff --git a/source/runtime/gc.c b/source/runtime/gc.c
new file mode 100644 (file)
index 0000000..541d26b
--- /dev/null
@@ -0,0 +1,37 @@
+#include "gc.h"
+#include <stdlib.h>
+
+/*****************************************************************************/
+
+typedef struct {
+    uint64_t objmap;
+    uint8_t data[];
+} obj_t;
+
+void gc_init(void* stack_bottom)
+{
+}
+
+void* gc_alloc(uint64_t objmap, size_t num_slots)
+{
+    obj_t* obj;
+    if (num_slots <= (sizeof(uint64_t) - 1u)) {
+        obj = (void*)malloc(sizeof(obj_t) + (num_slots * sizeof(uintptr_t)));
+    } else {
+        obj = (void*)malloc(sizeof(obj_t) + (num_slots * sizeof(uintptr_t)));
+    }
+    obj->objmap = objmap;
+    obj++;
+    return (void*)obj;
+}
+
+void gc_collect(void)
+{
+}
+
+void gc_shutdown(void)
+{
+}
+
+/*****************************************************************************/
+
diff --git a/source/runtime/gc.h b/source/runtime/gc.h
new file mode 100644 (file)
index 0000000..dd14cc4
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+  @file gc.h
+  @brief TODO: Describe this file
+*/
+#ifndef GC_H
+#define GC_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+void gc_init(void* stack_bottom);
+
+void* gc_alloc(uint64_t objmap, size_t size);
+
+void gc_collect(void);
+
+void gc_shutdown(void);
+
+#endif /* GC_H */
diff --git a/source/runtime/main.c b/source/runtime/main.c
new file mode 100644 (file)
index 0000000..c232333
--- /dev/null
@@ -0,0 +1,11 @@
+#include "gc.h"
+
+int main(int argc, char** argv) {
+    extern int ATC_Main(int argc, char** argv);
+    int ret_code;
+    gc_init(&ret_code);
+    ret_code = ATC_Main(argc, argv);
+    gc_shutdown();
+    return ret_code;
+}
+