Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

New Runtime Features #145

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ deploy:
secure: Prcon+FjPLo1nh6hdJ1byLAUTMU/vfq3fBLzkxQIyJTVKIeKg9mPVtNoCmvbgxsSVTdS+gPjIoMpt0LgZCUq/cDRJAtOIaAqbm+fVNJBTwgkgwYAG7hCjEprAhUYiqutT+7KhgNZSKUBNJo/w5sWl8xdsSbfHyldGP6XBcocL50=
on:
tags: true
repo: runtimejs/runtime
repo: runtimejs/runtime
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# runtime.js

[![Build Status](https://travis-ci.org/runtimejs/runtime.svg?branch=master)](https://travis-ci.org/runtimejs/runtime) [![npm](https://img.shields.io/npm/v/runtimejs.svg)](https://www.npmjs.com/package/runtimejs) [![Gem](https://img.shields.io/badge/freenode-%23runtimejs-blue.svg)](https://freenode.net/) [![Travis](https://img.shields.io/badge/GITTER-JOIN_CHAT_%E2%86%92-1dce73.svg)](https://gitter.im/runtimejs/runtime)
[![Build Status](https://travis-ci.org/runtimejs/runtime.svg?branch=master)](https://travis-ci.org/Ross-Computers/runtime) [![npm](https://img.shields.io/npm/v/runtimejs.svg)](https://www.npmjs.com/package/runtimejs) [![Gem](https://img.shields.io/badge/freenode-%23runtimejs-blue.svg)](https://freenode.net/) [![Travis](https://img.shields.io/badge/GITTER-JOIN_CHAT_%E2%86%92-1dce73.svg)](https://gitter.im/runtimejs/runtime)

__runtime.js__ is an open-source library operating system (unikernel) for the cloud that runs JavaScript, can be bundled up with an application and deployed as a lightweight and immutable VM image.

Expand Down
80 changes: 61 additions & 19 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@ import os
import sys
import datetime

arch = os.getenv('ARCH', "x64")
arch_caps = os.getenv('ARCH', "X64")
bits = os.getenv('BITS', "64")
arch_alt = os.getenv('ALT_ARCH', "x86_64")

SetOption('num_jobs', 4)

build = os.getenv('RUNTIME_BUILD', "debug")
print 'Build', build
print 'Arch',arch
print 'CPU Bits',bits

config = {
"project_name": "out/runtimejs",
"binary_output_file": "disk/boot/runtime",
"toolchain_bin_path": "",
"fasm_pathname": "fasm",
"link_script": "etc/kernel.ld",
"name_gxx": "x86_64-elf-g++",
"name_gcc": "x86_64-elf-gcc",
"name_as": "x86_64-elf-as",
"name_ld": "x86_64-elf-gcc",
"name_ar": "x86_64-elf-ar",
"name_ranlib": "x86_64-elf-ranlib",
"name_objcopy": "x86_64-elf-objcopy",
"name_gxx": arch_alt+"-elf-g++",
"name_gcc": arch_alt+"-elf-gcc",
"name_as": arch_alt+"-elf-as",
"name_ld": arch_alt+"-elf-gcc",
"name_ar": arch_alt+"-elf-ar",
"name_ranlib": arch_alt+"-elf-ranlib",
"name_objcopy": arch_alt+"-elf-objcopy",
"flags_common": {
"shared": set([
'-m64',
'-m'+bits,
'-ffreestanding',
'-nostdlib',
'-mno-red-zone',
Expand All @@ -38,7 +45,12 @@ config = {
'-Wno-unused-parameter',
'-fdiagnostics-color',
'-D__runtime_js__',
'-DRUNTIMEJS_PLATFORM_X64',
'-DRT_INC_ADDR_SPACE=\<kernel/arch/'+arch+'/address-space-'+arch+'.h\>',
'-DRT_INC_CPU=\<kernel/arch/'+arch+'/cpu-'+arch+'.h\>',
'-DRT_INC_IO=\<kernel/arch/'+arch+'/io-'+arch+'.h\>',
'-DRT_INC_IRQ=\<kernel/arch/'+arch+'/irqs-'+arch+'.h\>',
'-DRT_INC_PLATFORM=\<kernel/arch/'+arch+'/platform-'+arch+'.h\>',
'-DRUNTIMEJS_PLATFORM_'+arch_caps,
]),
"release": set([
]),
Expand All @@ -55,8 +67,8 @@ config = {
'-U__STRICT_ANSI__',
'-DENABLE_DEBUGGER_SUPPORT',
'-DENABLE_DISASSEMBLER',
'-DV8_HOST_ARCH_X64',
'-DV8_TARGET_ARCH_X64',
'-DV8_HOST_ARCH_'+arch_caps,
'-DV8_TARGET_ARCH_'+arch_caps,
# '-DV8_DEPRECATION_WARNINGS',
# '-DV8_IMMINENT_DEPRECATION_WARNINGS',
# '-DVERIFY_HEAP',
Expand Down Expand Up @@ -85,32 +97,52 @@ config = {
},
"flags_link": set([
'-nostdlib',
'-nodefaultlibs',
# '-Map etc/map.txt',
'-nodefaultlibs'
]),
"locations": {
"cc": [
'src',
'src/arch',
'src/kernel',
'src/kernel/x64',
'src/kernel/arch',
'src/kernel/arch/'+arch,
'src/kernel/boot',
'src/kernel/sys',
'src/kernel/sys/fs',
'src/kernel/sys/hw',
'src/kernel/sys/io',
'src/kernel/sys/memory',
'src/kernel/sys/thread',
'src/kernel/sys/v8',
'src/kernel/utils',
'src/kernel/profiler',
'src/common',
'test/cc',
],
"asm": [
'src',
'src/kernel/x64',
'src/kernel/arch',
'src/kernel/arch/'+arch,
'src/kernel/boot',
'src/kernel/sys',
'src/kernel/sys/fs',
'src/kernel/sys/hw',
'src/kernel/sys/io',
'src/kernel/sys/memory',
'src/kernel/sys/thread',
'src/kernel/sys/v8',
'src/kernel/utils',
'src/'+arch
],
"js": [
'src/kernel/Js',
'src/kernel/js',
],
},
"includes": [
'deps/musl/src/internal',
'deps/musl/include',
'deps/musl/arch/x86_64',
'deps/musl/arch/x86_64/bits',
'deps/musl/arch/'+arch_alt,
'deps/musl/arch/'+arch_alt+'/bits',
'deps/libcxx/include',
'deps/v8/include',
'deps/v8',
Expand All @@ -120,6 +152,8 @@ config = {
'deps/miniz',
'deps/libsodium/src/libsodium/include',
'deps/json11',
'src/include',
'src/include/kernel',
'src',
'test',
],
Expand Down Expand Up @@ -178,6 +212,10 @@ def EnvironmentCreate(build):
AR = ar,
AS = _as,
RANLIB = ranlib,
ARCH = arch,
ARCH_CAPS = arch_caps,
ALT_ARCH = arch_alt,
BITS = bits,
CXXFLAGS = " ".join(flags_gxx),
CFLAGS = " ".join(flags_gcc),
LINK = ld,
Expand All @@ -186,7 +224,7 @@ def EnvironmentCreate(build):
LINKCOMSTR = 'Link $TARGET',
RANLIBCOMSTR = 'Index $TARGET',
ARCOMSTR = 'Archive $TARGET',
ENV = {'PATH': os.environ['PATH']},
ENV = {'PATH': os.environ['PATH'],'ARCH': arch,'ARCH_CAPS':arch_caps,'ALT_ARCH':arch_alt,'BITS':bits},
)

env.Append(
Expand Down Expand Up @@ -216,6 +254,10 @@ def BuildProject(env_base):
env.Replace(CPPPATH = config["includes"])
env.Replace(LIBS = config["libs"])
env.Replace(LIBPATH = ['deps'])
env.Replace(ARCH = arch)
env.Replace(ARCH_CAPS = arch_caps)
env.Replace(ALT_ARCH = arch_alt)
env.Replace(BITS = bits)

version_header = env.Command('src/kernel/version-autogenerated.h', 'package.json',
'node scripts/update-versions.js')
Expand Down
88 changes: 48 additions & 40 deletions deps/SConscript
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import os
Import('env_base')

ARCH = os.getenv('ARCH', "x64")
ARCH_CAPS = os.getenv('ARCH_CAPS', "X64")
ALT_ARCH = os.getenv('ALT_ARCH', "x86_64")
BITS = os.getenv('BITS', "64")

libs_config = {
"v8": {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/$ALT_ARCH',
'musl/arch/$ALT_ARCH/bits',
'libcxx/include',
'eastl/include',
'concurrentqueue',
Expand All @@ -17,6 +23,8 @@ libs_config = {
'v8/src',
'v8',
'../src',
'../src/include',
'../src/include/kernel'
],
"source": [
'v8/src/accessors.cc',
Expand Down Expand Up @@ -390,30 +398,30 @@ libs_config = {
'v8/src/wasm/wasm-opcodes.cc',
'v8/src/wasm/wasm-result.cc',
'v8/src/zone.cc',
'v8/src/crankshaft/x64/lithium-codegen-x64.cc',
'v8/src/crankshaft/x64/lithium-gap-resolver-x64.cc',
'v8/src/crankshaft/x64/lithium-x64.cc',
'v8/src/x64/assembler-x64.cc',
'v8/src/x64/builtins-x64.cc',
'v8/src/x64/code-stubs-x64.cc',
'v8/src/x64/codegen-x64.cc',
'v8/src/x64/cpu-x64.cc',
'v8/src/x64/deoptimizer-x64.cc',
'v8/src/x64/disasm-x64.cc',
'v8/src/x64/frames-x64.cc',
'v8/src/x64/interface-descriptors-x64.cc',
'v8/src/x64/macro-assembler-x64.cc',
'v8/src/debug/x64/debug-x64.cc',
'v8/src/full-codegen/x64/full-codegen-x64.cc',
'v8/src/ic/x64/access-compiler-x64.cc',
'v8/src/ic/x64/handler-compiler-x64.cc',
'v8/src/ic/x64/ic-x64.cc',
'v8/src/ic/x64/ic-compiler-x64.cc',
'v8/src/ic/x64/stub-cache-x64.cc',
'v8/src/regexp/x64/regexp-macro-assembler-x64.cc',
'v8/src/compiler/x64/code-generator-x64.cc',
'v8/src/compiler/x64/instruction-scheduler-x64.cc',
'v8/src/compiler/x64/instruction-selector-x64.cc',
'v8/src/crankshaft/'+ARCH+'/lithium-codegen-'+ARCH+'.cc',
'v8/src/crankshaft/'+ARCH+'/lithium-gap-resolver-'+ARCH+'.cc',
'v8/src/crankshaft/'+ARCH+'/lithium-'+ARCH+'.cc',
'v8/src/'+ARCH+'/assembler-'+ARCH+'.cc',
'v8/src/'+ARCH+'/builtins-'+ARCH+'.cc',
'v8/src/'+ARCH+'/code-stubs-'+ARCH+'.cc',
'v8/src/'+ARCH+'/codegen-'+ARCH+'.cc',
'v8/src/'+ARCH+'/cpu-'+ARCH+'.cc',
'v8/src/'+ARCH+'/deoptimizer-'+ARCH+'.cc',
'v8/src/'+ARCH+'/disasm-'+ARCH+'.cc',
'v8/src/'+ARCH+'/frames-'+ARCH+'.cc',
'v8/src/'+ARCH+'/interface-descriptors-'+ARCH+'.cc',
'v8/src/'+ARCH+'/macro-assembler-'+ARCH+'.cc',
'v8/src/debug/'+ARCH+'/debug-'+ARCH+'.cc',
'v8/src/full-codegen/'+ARCH+'/full-codegen-'+ARCH+'.cc',
'v8/src/ic/'+ARCH+'/access-compiler-'+ARCH+'.cc',
'v8/src/ic/'+ARCH+'/handler-compiler-'+ARCH+'.cc',
'v8/src/ic/'+ARCH+'/ic-'+ARCH+'.cc',
'v8/src/ic/'+ARCH+'/ic-compiler-'+ARCH+'.cc',
'v8/src/ic/'+ARCH+'/stub-cache-'+ARCH+'.cc',
'v8/src/regexp/'+ARCH+'/regexp-macro-assembler-'+ARCH+'.cc',
'v8/src/compiler/'+ARCH+'/code-generator-'+ARCH+'.cc',
'v8/src/compiler/'+ARCH+'/instruction-scheduler-'+ARCH+'.cc',
'v8/src/compiler/'+ARCH+'/instruction-selector-'+ARCH+'.cc',

'v8/src/base/accounting-allocator.cc',
'v8/src/base/atomicops_internals_x86_gcc.cc',
Expand Down Expand Up @@ -447,8 +455,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
'libcxx/include',
'../src',
],
Expand All @@ -472,8 +480,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
'acpica/source/include',
],
"source": [
Expand Down Expand Up @@ -1059,8 +1067,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
],
"source": [
'libcxxrt/src/typeinfo.cc',
Expand All @@ -1072,8 +1080,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
],
"source": [
'printf/printf.cc',
Expand All @@ -1083,8 +1091,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
],
"source": [
'miniz/tinfl.c',
Expand All @@ -1094,8 +1102,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
'libsodium/src/libsodium/include/sodium',
],
"source": [
Expand Down Expand Up @@ -1243,8 +1251,8 @@ libs_config = {
"include": [
'musl/src/internal',
'musl/include',
'musl/arch/x86_64',
'musl/arch/x86_64/bits',
'musl/arch/'+ALT_ARCH,
'musl/arch/'+ALT_ARCH+'/bits',
'libcxx/include',
'json11'
],
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/base/platform/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#endif

#if V8_OS_RUNTIMEJS
#include <kernel/threadlib/mutex.h>
#include <kernel/threadlib/condvar.h>
#include <threadlib/mutex.h>
#include <threadlib/condvar.h>
#endif

namespace v8 {
Expand Down
2 changes: 1 addition & 1 deletion etc/kernel.ld
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SECTIONS
}
.text 0x0000000000201000 :
{
src/startup.o (.text)
src/kernel/boot/startup.o (.text)
*(.text)
*(.gnu.linkonce.t*)
. = ALIGN(4096);
Expand Down
3 changes: 3 additions & 0 deletions js/__loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
inherits: './modules/inherits.js',
sys: 'util/util.js',
util: 'util/util.js',
tty: './modules/tty.js',
}, runtimePackagePath);

loader.require(`${runtimePackagePath}/index.js`);
Expand Down Expand Up @@ -300,6 +301,8 @@
process.stderr = new StderrStream();
process.termout = new TermoutStream();
process.termerr = new TermerrStream();
process.argv = process.execArgv = __SYSCALL.getCommandLine().split(" ");
process.title = process.argv0 = process.execPath = process.argv[0];
loader.require('console');
loader.require('/');
})();
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading