A Rustic Javascript Interpreter CIS Department Senior Design 2015-2016 1

Total Page:16

File Type:pdf, Size:1020Kb

A Rustic Javascript Interpreter CIS Department Senior Design 2015-2016 1 js.rs { A Rustic JavaScript Interpreter CIS Department Senior Design 2015-2016 1 Terry Sun Sam Rossi [email protected] [email protected] April 25, 2016 Abstract trol flow modifying statements. We aimed for correctness in any language feature that JavaScript is an incredibly widespread lan- we implemented. guage, running on virtually every modern computer and browser, and interpreters such This project aimed for breadth of coverage: as NodeJS allow JavaScript to be used as a Js.rs supports more common language fea- server-side language. Unfortunately, modern tures at the cost of excluding certain edge implementations of JavaScript engines are cases. Additionally, Js.rs does not focus on typically written in C/C++, languages re- achieving optimal performance nor memory liant on manual memory management. This usage, as it is a proof-of-concept project. results in countless memory leaks, bugs, and security vulnerabilities related to memory mis-management. 2 Background Js.rs is a prototype server-side JavaScript in- 2.1 Rust terpreter in Rust, a new systems program- ming language for building programs with Rust is a programming language spear- strong memory safety guarantees and speeds headed by Mozilla. It is a general-purpose comparable to C++. Our interpreter runs programming language emphasizing memory code either from source files or an interac- safety and speed concerns. Rust's initial sta- tive REPL (read-evaluate-print-loop), sim- ble release (version 1.0) was released in May ilar to the functionality of existing server- 2015. side JavaScript interpreters. We intend to demonstrate the viability of using Rust to Rust guarantees memory safety in a unique implement JavaScript by implementing a way compared to other commonly used pro- core subset of language features. To that gramming languages. The compiler stati- end, we've tested our coverage using Google's cally analyzes the source code, tracking the Sputnik test suite, an ECMAScript 5 confor- \lifetime" of any heap-allocated data. When mance test suite. all existent pointers to a piece of data has gone out of scope (e.g. at the end of a func- tion), then the compiler determines that the 1 Introduction data is no longer alive and the allocated space can be freed. This memory manage- Js.rs is a prototype JavaScript interpreter, ment system prevents many classic memory targeting core language features. This in- errors by disallowing the programmer from cludes variable assignment, expression lit- accessing uninitialized or already-freed mem- erals, unary and binary operators, function ory. calls, code blocks, and different types of con- 1Advised by Dr. Zdancewic ([email protected]) 1 Compare this system to other memory-safe system. JavaScript has many functional fea- languages, which rely on garbage collection tures, such as first class functions, anony- to find and free memory which is no longer mous functions, and closures. relevant to the running program. Garbage collection incurs significant runtime perfor- JavaScript was first developed at Netscape mance costs. by Brendan Eich 1995 for inclusion with their internet browser. Today, JavaScript Rust code compiles down to a native exe- is defined by the ECMAScript specification, cutable. The Rust compiler uses an LLVM- first released in 1997 by the European Com- backend to emit assembly, taking advantage puter Manufacturer Association (ECMA) in of LLVM's extensive optimization options. response to the emergence of a few forks of In addition, there is no runtime associated the JavaScript implementations. The cur- with executing Rust binaries; Rust is not run rent version is ECMAScript 6, released in by a virtual machine (e.g. Java), nor does it June 2015; ECMAScript 7 is still under de- use garbage collection during execution. velopment. Rust also provides high-level programming JavaScript has been deployed as a server- language features, such as an type system side language since late 1995. It has gained based on interfaces (known as \traits") and popularity as a server development language generics, funtional programming and clo- since Node.js was released in 2006. sures, and a set of concurrency primitives. This makes it a very attractive languages There are many JavaScript resources avail- for people who are concerned about the per- able online. We primarily referenced formance of their program, but wish to use the Mozilla Developer Network's official something more ergonomic than C or C++. JavaScript documentation[4], which provide The Rust standard library is written with breakdowns of many pieces of JavaScript both performance and ergonomics in mind. behavior. Additionally, we made use of a conformance test suite named Sputnik, re- 2.2 JavaScript leased by Google in 2009. Sputnik tests the ECMAScript 5 standard, but includes only JavaScript is an extremely widely used pro- those features which were present in EC- gramming language. It is one of the core MAScript 3. This arrangement was chosen languages used on the Internet; it is included due to the presence of numerous ambigui- on the majority of the websites across the ties in the third specification, which were re- Internet, and is supported by all major web solved in ECMAScript 5. browsers. In addition, it has many desktop applications, e.g., used as a scripting lan- guage, or embedded in PDFs. 3 Design JavaScript is a high-level, imperative pro- 3.1 Parser gramming language. It is typically inter- preted, and is loosely typed; any variable The first part of the interpreter is the parser, can be passed into any function or opera- takes in a string of JavaScript and generates tor. The type system is composed of seven an Abstract Syntax Tree (AST). An AST primitives types (Number, Boolean, null, contains the structure and the content of a undefined, String, Object, Symbol). Cus- program, but not the specific syntactic com- tom types can be created by inheriting from ponents such as whitespacing. Object, using a prototype-based inheritance 2 We wrote our parser using a parser genera- Type System tor, a common pattern in building parsers. This consists of defining the grammar of In JavaScript, a value can either be located the language (i.e. the valid tokens of the on the stack or on the heap. Primitive values language and the valid sequences of those (e.g. numbers, boolean) are located on the tokens which have semantic meaning in the stack, whereas as all references (such as ob- language); the parser generator takes this jects or anything created from a constructor) grammar specification as input and gener- are located on the heap. To model this prop- ates code to parse the grammar in the target erly, our type system used a pair of types for language (in this case, Rust). Parser genera- each value. JsVar contains the type of the tors tend to be a bit slower in practice than value, as well as any stack-related value (such writing an equivalent parser manually, but as the Rust number or boolean containing using a parser generate greatly increases the the value itself); additionally, each JsVar rate of development due to the ease of use. can optionally be paired with a JsPtrEnum, We opted to use a parser generator rather which contains a reference to any heap al- than writing a custom parser, as we wanted located data that the value may require. to focus on language implementation rather Each JsVar also contains an optional unique than performance. binding, which acts as a lookup identifier for use with heap datatype provided by French Press. The two most widely used parser generators are YACC and Bison, which are implemented in C. Neither of these would be suitable for For example, for the object f x: 3.5, y: our project, as we intended to use only Rust "foo" g, the JsVar would indicate that the libraries in our interpreter to maintain the value is of type \object". The JsPtrEnum for safety guarantees. After some research, we the object would contain a HashMap with the decided to use LALRPOP, a pure Rust LR(1) keys "x" and "y". The value for "x" would parser generator[2]. be a JsVar of type \number" and with float- ing point value 3.5, and the value for "y" would be a JsVar with the type \string" and a unique binding which can be used to look up the heap data. 3.2 Garbage Collector JavaScript is a garbage collected language, 3.3 Runtime as it relies on a runtime system to man- age the memory used by a running program. The \runtime" is the most substantial por- This runtime must allocate memory when re- tion of the interpreter, as it is what accepts quested by the language, and free memory the AST as input and evaluates the language when it is determined that allocated data semantics represented by each node. The is no longer accessible by the running pro- runtime is broken down into many modu- gram. We used a garbage collection library, lar components; each module handles a par- French Press. French Press was being devel- ticular type of expression or functionality, oped concurrency by David Mally, a UPenn such as coercion between JavaScript types Masters student, for his Masters thesis. Js.rs or evaluation of literal expressions. Then, is tightly coupled with French Press, sharing higher-level components handle larger pieces a common library defining a shared represen- of code, such as code blocks embedded within tation of the JavaScript type system. function definitions or try-catch constructs. 3 Functions, Scoping, and Closures Assignment statements One of the most complex parts of imple- There are two ways to assign values to vari- menting the runtime was ensuring that it able bindings in JavaScript. A declaration exhibited the correct behavior with regards (var x = y) will create a variable in the cur- to functions and scoping.
Recommended publications
  • Oral History of Winifred Mitchell Baker
    ........ Computer • History Museum Oral History of Winifred Mitchell Baker Interviewed by: Marc Weber Recorded: December 10, 2014 Mountain View, California CHM Reference number: X7311.2015 © 2015 Computer History Museum Oral History of Winifred Mitchell Baker Marc Weber: I'm Marc Weber of the Computer History Museum. And I'm here with Mitchell Baker, Chairwoman of Mozilla. Thank you so much for doing this interview. Winifred Mitchell Baker: Thanks, Marc. I'm happy to be here. The museum has been a bright spot for a long time, so I'm honored as well. Weber: Thank you. As am I. So start with a bit of your background. What is your full name? And when and where were you born? Baker: My full name is Winifred Mitchell Baker. My mom was a little eccentric though, and she never wanted me to use Winifred. So it's my first name. But in her mind, I was always Mitchell. So that's what I go by. And I was born in Berkeley in California in 1959. Weber: And tell me a little bit about your family and where you grew up. Baker: I grew up in Oakland, so the East Bay across from San Francisco. It borders Berkeley. My parents were born and raised on the East Coast and moved west, as people did in the '50s, where it seemed [like] starting a new life. They were each eccentric. And each had their own view of their world and really clear opinions. And I think some of that has rubbed off actually. Weber: So eccentric in what way? What did they do? Baker: Well, my dad was a classic entrepreneur.
    [Show full text]
  • Maelstrom Web Browser Free Download
    maelstrom web browser free download 11 Interesting Web Browsers (That Aren’t Chrome) Whether it’s to peruse GitHub, send the odd tweetstorm or catch-up on the latest Netflix hit — Chrome’s the one . But when was the last time you actually considered any alternative? It’s close to three decades since the first browser arrived; chances are it’s been several years since you even looked beyond Chrome. There’s never been more choice and variety in what you use to build sites and surf the web (the 90s are back, right?) . So, here’s a run-down of 11 browsers that may be worth a look, for a variety of reasons . Brave: Stopping the trackers. Brave is an open-source browser, co-founded by Brendan Eich of Mozilla and JavaScript fame. It’s hoping it can ‘save the web’ . Available for a variety of desktop and mobile operating systems, Brave touts itself as a ‘faster and safer’ web browser. It achieves this, somewhat controversially, by automatically blocking ads and trackers. “Brave is the only approach to the Web that puts users first in ownership and control of their browsing data by blocking trackers by default, with no exceptions.” — Brendan Eich. Brave’s goal is to provide an alternative to the current system publishers employ of providing free content to users supported by advertising revenue. Developers are encouraged to contribute to the project on GitHub, and publishers are invited to become a partner in order to work towards an alternative way to earn from their content. Ghost: Multi-session browsing.
    [Show full text]
  • 1. with Examples of Different Programming Languages Show How Programming Languages Are Organized Along the Given Rubrics: I
    AGBOOLA ABIOLA CSC302 17/SCI01/007 COMPUTER SCIENCE ASSIGNMENT ​ 1. With examples of different programming languages show how programming languages are organized along the given rubrics: i. Unstructured, structured, modular, object oriented, aspect oriented, activity oriented and event oriented programming requirement. ii. Based on domain requirements. iii. Based on requirements i and ii above. 2. Give brief preview of the evolution of programming languages in a chronological order. 3. Vividly distinguish between modular programming paradigm and object oriented programming paradigm. Answer 1i). UNSTRUCTURED LANGUAGE DEVELOPER DATE Assembly Language 1949 FORTRAN John Backus 1957 COBOL CODASYL, ANSI, ISO 1959 JOSS Cliff Shaw, RAND 1963 BASIC John G. Kemeny, Thomas E. Kurtz 1964 TELCOMP BBN 1965 MUMPS Neil Pappalardo 1966 FOCAL Richard Merrill, DEC 1968 STRUCTURED LANGUAGE DEVELOPER DATE ALGOL 58 Friedrich L. Bauer, and co. 1958 ALGOL 60 Backus, Bauer and co. 1960 ABC CWI 1980 Ada United States Department of Defence 1980 Accent R NIS 1980 Action! Optimized Systems Software 1983 Alef Phil Winterbottom 1992 DASL Sun Micro-systems Laboratories 1999-2003 MODULAR LANGUAGE DEVELOPER DATE ALGOL W Niklaus Wirth, Tony Hoare 1966 APL Larry Breed, Dick Lathwell and co. 1966 ALGOL 68 A. Van Wijngaarden and co. 1968 AMOS BASIC FranÇois Lionet anConstantin Stiropoulos 1990 Alice ML Saarland University 2000 Agda Ulf Norell;Catarina coquand(1.0) 2007 Arc Paul Graham, Robert Morris and co. 2008 Bosque Mark Marron 2019 OBJECT-ORIENTED LANGUAGE DEVELOPER DATE C* Thinking Machine 1987 Actor Charles Duff 1988 Aldor Thomas J. Watson Research Center 1990 Amiga E Wouter van Oortmerssen 1993 Action Script Macromedia 1998 BeanShell JCP 1999 AngelScript Andreas Jönsson 2003 Boo Rodrigo B.
    [Show full text]
  • Virtual Machines for Dynamic Languages Ausgewählte Kapitel Der Systemsoftwaretechnik, WS2021
    Virtual Machines for Dynamic Languages Ausgewählte Kapitel der Systemsoftwaretechnik, WS2021 Mark Deutel Friedrich-Alexander-University Erlangen-Nürnberg (FAU) Erlangen, Germany [email protected] ABSTRACT threading model. It is common that once a dynamic language has A common approach to execute dynamic languages is inside a vir- grown popular enough the interpreter is extended by a just-in-time tual machine (VM), usually implemented in a low level system (JIT) compiler to more efficiently execute interpreted code. language like C. Such VMs have to support the often complex However this approach does not come without problems. The syntax and semantics of the dynamic languages they are hosting. effort required to write a complete virtual machine from scratch Additionally, some properties of dynamic language code can only is huge. It also forces the language implementer to deal with plat- be inferred at runtime making the optimization of code execution form or target architecture specific details. This makes implement- another challenging task. Therefore, it is hardly possible to provide ing a VM time consuming, error prone, and complicated to port general purpose implementations that support a large range of to other systems. Additionally, modern dynamic languages like different dynamic languages. Furthermore, many commonly used Python, Ruby or JavaScript evolve rapidly and have complex syn- dynamic languages such as Python or Javascript are still evolving tax and semantics. This not only makes it hard to represent the which means that their VMs have to adapt constantly. This implies language properly in low level code, but makes maintenance of that it is necessary to write and maintain a sufficiently elaborated existing VM implementations a complicated task as well.
    [Show full text]
  • Web Evolution and Webassembly
    Web Evolution and WebAssembly COMP 520 - Special Topics Lecture I David Herrera March 29, 2019 Contents ● Limitations of JavaScript ● Evolution of Web performance via asm.js ● WebAssembly ○ Design ○ Pipeline ■ Decoding ■ Validation ■ Execution ○ Examples JavaScript - What is JavaScript? ● Dynamic, high-level language ● 10 days!, Famously designed and prototyped in ten days by Brendan Eich ● Little Performance Design: Language was not designed with performance in mind. ● Web Language: Has been the main programming language for the web since 1999 Limitations of JavaScript ● Tough Target: Dynamically typed nature makes it a “tough target” of static languages such as C and C++, as well as a relatively slow language. ● Lacks Parallelism: No real parallelism supported natively. (At least not widely supported by all browsers, or general with full control) ● Number type: Numbers are restricted to doubles, float64. This means that for instance, an i64 number cannot be represented natively in JavaScript. Let’s look at speed JavaScript as a target language for C/C++? ● Is it Doable? Yes, since JavaScript is turing complete, it should be able to represent any sort of weird semantics. JavaScript as a target language for C/C++? ● Is it Doable? Yes, since JavaScript is turing complete, it should be able to represent any sort of weird semantics. ● Is it efficient? Let’s look at Emscripten ● Emscripten is a static compiler from LLVM to JavaScript created in 2011 ● Asm.js is a“typed” subset of JavaScript which serves as a target for Emscripten ● Initial goal was to support a large enough subset of C and C++ constructs that could be run on the web.
    [Show full text]
  • Évaluation De La Valeur À L'ère Du Web: Proposition De Modèle De Valorisation Des Projets Non Marchands
    Évaluation de la valeur à l’ère du web : Proposition de modèle de valorisation des projets non marchands François Druel To cite this version: François Druel. Évaluation de la valeur à l’ère du web : Proposition de modèle de valorisation des projets non marchands. Sciences de l’ingénieur [physics]. Université d’Angers, 2007. Français. tel- 00346337 HAL Id: tel-00346337 https://tel.archives-ouvertes.fr/tel-00346337 Submitted on 11 Dec 2008 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. UNIVERSITÉ D’ANGERS ANNÉE : 2007 NUMÉRO D’ORDRE : 845 Évaluation de la valeur à l’ère du web : Proposition de modèle de valorisation des projets non marchands ÉCOLE DOCTORALE D’ANGERS THÈSE DE DOCTORAT Spécialité : SCIENCES POUR L’INGÉNIEUR Présentée et soutenue publiquement le 14 novembre 2007 à l’INSTITUT DES SCIENCES ET TECHNIQUES DE L’INGÉNIEUR D’ANGERS 62, avenue Notre-Dame du Lac, Angers par FRANÇOIS DRUEL Devant le jury d’examen composé de : Messieurs : Vincent BOLY : professeur des Universités – ENSGSI – rapporteur Fabrice PAPY : maître de conférence (HDR)– UNIVERSITÉ PARIS VIII – rapporteur Simon RICHIR : professeur des Universités – ENSAM – directeur de thèse Henri SAMIER : maître de conférences – ISTIA INNOVATION – encadrant de recherche Pascal CRUBLEAU : maître de conférences – ISTIA INNOVATION – examinateur Norbert PAQUEL : professeur associé – UNIVERSITÉ PARIS VIII – examinateur LABORATOIRE PRÉSENCE-INNOVATION —ENSAM CENTRE D’ANGERS — 4, rue de l’Ermitage 53000 LAVAL 2 Je dédie ce travail de recherche à la mémoire de JEAN-PAUL NEAU, mon premier mentor.
    [Show full text]
  • Javascript: the Good Parts Vs. Javascript: the Definitive Guide
    JavaScript: The Good Parts vs. JavaScript: The Definitive Guide For next class, read http://eloquentjavascript.net/ chapters 1-4. CS 152: Programming Language Paradigms JavaScript Prof. Tom Austin San José State University History of JavaScript 1995: Netscape hired Brendan Eich. His job: implement Scheme for Brendan Eich the web browser. After a few meetings, Scheme was deemed too weird… In 10 days, Brendan Eich wrote the initial version of JavaScript for Netscape 2.0 Beta. JavaScript • Superficially similar to Java • Primarily client-side programming • Server-side variants: –JVM: Rhino & Nashorn –Node.js • http://w3schools.com/js/default.asp JavaScript is multi-paradigm: • Imperative • Functional – "Scheme in C's clothing" • Object-oriented – Prototype-based Imperative JavaScript function addList(list) { var i, sum=0; for (i=0; i<list.length; i++){ sum += list[i]; } return sum; } Functional JavaScript var addList = function(list) { if (list.length === 0) { return 0; } return list[0] + addList(list.slice(1)); } Object-Oriented JavaScript function Adder (amount) { this.amount = amount; } Adder.prototype.add = function(x){ return this.amount + x; } var myAdder = new Adder(1); var y = myAdder.add(7); Extended JavaScript Examples (in-class) Introduction to Node.js Node.js • Server-side JavaScript • Based on Google's V8 engine • npm: Node.js package manager • http://nodejs.org/ myFile.txt This is my file. There are many like it, but this one is mine. File I/O in Node.js Callback var fs = require('fs'); function fs.readFile('myFile.txt', function(err,data) { if (err) throw err; console.log(""+data); }); console.log('all done'); Resulting Output all done This is my file.
    [Show full text]
  • Mozilla Development Roadmap
    mozilla development roadmap Brendan Eich, David Hyatt table of contents • introduction • milestone schedule • about ownership... • a new • current release • what all this does not roadmap status mean • discussion • how you can help • application architecture • summary • project • to-do list rationale management introduction Welcome to the Mozilla development roadmap. This is the third major roadmap revision, with a notable recent change to the status of the integrated Mozilla application suite, since the original roadmap that set Mozilla on a new course for standards compliance, modularity, and portability in 1998. The previous roadmap documented milestones and rules of development through Mozilla 1.3, and contains links to older roadmaps. Most of this document reflects the new application architecture proposal made last year. The effort resulting from that proposal has finally borne fruit, or to mix metaphors, hatched new application creatures: Firefox and Thunderbird. The new, significant roadmap update hoped for early in 2004 has been postponed. See Brendan's roadmap blog for thoughts that may feed into it. An interim roadmap update focused on the "aviary 1.0" 1 From www.mozilla.org/roadmap.html 4 August 2004 releases of Firefox 1.0 and Thunderbird 1.0, and the 1.8 milestone that will follow, is coming soon. We have come a long way. We have achieved a Mozilla 1.0 milestone that satisfies the criteria put forth in the Mozilla 1.0 manifesto, giving the community and the wider world a high-quality release, and a stable branch for conservative development and derivative product releases. See the Mozilla Hall of Fame for a list of Mozilla-based projects and products that benefited from 1.0.
    [Show full text]
  • Javascript: the First 20 Years
    JavaScript: The First 20 Years ALLEN WIRFS-BROCK, Wirfs-Brock Associates, Inc., USA BRENDAN EICH, Brave Software, Inc., USA Shepherds: Sukyoung Ryu, KAIST, South Korea Richard P. Gabriel: poet, writer, computer scientist How a sidekick scripting language for Java, created at Netscape in a ten-day hack, ships first as a de facto Web standard and eventually becomes the world’s most widely used programming language. This paper tells the story of the creation, design, evolution, and standardization of the JavaScript language over the period of 1995–2015. But the story is not only about the technical details of the language. It is also the story of how people and organizations competed and collaborated to shape the JavaScript language which dominates the Web of 2020. CCS Concepts: • General and reference ! Computing standards, RFCs and guidelines; • Information systems ! World Wide Web; • Social and professional topics ! History of computing; History of programming languages; • Software and its engineering ! General programming languages; Scripting languages. Additional Key Words and Phrases: JavaScript, ECMAScript, Standards, Web browsers, Browser game theory, History of programming languages ACM Reference Format: Allen Wirfs-Brock and Brendan Eich. 2020. JavaScript: The First 20 Years. Proc. ACM Program. Lang. 4, HOPL (June 2020), 190 pages. https://doi.org/10.1145/3386327 1 INTRODUCTION In 2020, the World Wide Web is ubiquitous with over a billion websites accessible from billions of Web-connected devices. Each of those devices runs a Web browser or similar program which is able to process and display pages from those sites. The majority of those pages embed or load source code written in the JavaScript programming language.
    [Show full text]
  • Javascript: the Good Parts Vs. Javascript: the Definitive Guide CS252 – Advanced Programming Language Principles Prof
    JavaScript: The Good Parts vs. JavaScript: The Definitive Guide CS252 – Advanced Programming Language Principles Prof. Tom Austin, Fall 2014 JavaScript History of JavaScript In 1995, Netscape hired Brendan Eich to implement Scheme within the web browser. After a few meetings, Brendan Eich Scheme was deemed too weird… In 10 days, he wrote the initial version of JavaScript (then called Mocha) for Netscape 2.0 Beta. JavaScript • JavaScript looks superficially similar to languages like C++ and Java • Primarily client-side programming (i.e. code running in your browser & your machine), but some server-side variants – JVM: Rhino & Nashorn – Node.js • http://w3schools.com/js/default.asp JavaScript is multi-paradigm: • Imperative • Functional – "Scheme in C's clothing" • Object-oriented – Prototype-based Imperative JavaScript function addList(list) { var i, sum=0; for (i=0; i<list.length; i++){ sum += list[i]; } return sum; } Functional JavaScript var addList = function(list) { if (list.length === 0) { return 0; } return list[0] + addList(list.slice(1)); } Object-Oriented JavaScript function Adder (amount) { this.amount = amount; } Adder.prototype.add = function(x){ return this.amount + x; } var myAdder = new Adder(1); var y = myAdder.add(7); Extended JavaScript Examples (in-class) Introduction to Node.js Node.js • A JavaScript runtime and library designed for use outside the browser, based off of Google's V8 engine • npm: package manager for Node.js • http://nodejs.org/ myFile.txt This is my file. There are many like it, but this one is mine. File I/O in Node.js var fs = require('fs'); Callback fs.readFile('myFile.txt', function function(err,data) { if (err) throw err; console.log(""+data); }); console.log('all done'); Resulting Output all done This is my file.
    [Show full text]
  • Well, I'm Back: Choose Firefox Now, Or Later You Won't Get a Choice
    165 More Next Blog» Well, I'm Back Robert O'Callahan. Christian. Repatriate Kiwi. Mozilla hacker. FRIDAY, 8 AUGUST 2014 Choose Firefox Now, Or Later You Won't Get A Choice I know it's not the greatest marketing pitch, but it's the truth. Google is bent on establishing platform domination unlike anything we've ever s even from late-1990s Microsoft. Google controls Android, which is winning; Chro which is winning; and key Web properties in Search, Youtube, Gmail and Docs, are all winning. The potential for lock-in is vast and they're already exploiting it, f example by restricting certain Google Docs features (e.g. offline support) to Chro users, and by writing contracts with Android OEMs forcing them to make Chrom default browser. Other bad things are happening that I can't even talk about. Ind people and groups want to do the right thing but the corporation routes around th (E.g. PNaCl and Chromecast avoided Blink's Web standards commitments by d themselves not part of Blink.) If Google achieves a state where the Internet is re accessible through Chrome (or Android apps), that situation will be very difficult escape from, and it will give Google more power than any company has ever ha Microsoft and Apple will try to stop Google but even if they were to succeed, the only to replace one victor with another. So if you want an Internet --- which means, in many ways, a world --- that isn't co by Google, you must stop using Chrome now and encourage others to do the you don't, and Google wins, then in years to come you'll wish you had a choice a only yourself to blame for spurning it now.
    [Show full text]
  • META-TRACING JUST-IN-TIME COMPILATION for RPYTHON Inaugural-Dissertation Zur Erlangung Des Doktorgrades Der Mathematisch-Naturwi
    META-TRACINGJUST-IN-TIMECOMPILATIONFORRPYTHON Inaugural-Dissertation zur Erlangung des Doktorgrades der Mathematisch-Naturwissenschaftlichen Fakultät der Heinrich-Heine-Universität Düsseldorf vorgelegt von Carl Friedrich Bolz September 2012 ABSTRACT Many dynamic languages are implemented using traditional inter- preters because implementing just-in-time (JIT) compilers for them is too complex. This limits their performance and restricts their ap- plicability. This thesis describes meta-tracing, a technique that makes it possible to apply a single tracing JIT compiler across a wide va- riety of languages. Meta-tracing is flexible enough to incorporate typical JIT techniques such as run-time type feedback and unboxing. With the help of several case studies, meta-tracing is applied to vari- ous language implementations. Performance measurements of using meta-tracing show improvements by up to factor 50 for implemen- tations of production languages. Meta-tracing can thus simplify the implementation of high-performance virtual machines for dynamic languages significantly, making these languages more practical ina wider context. iii ZUSAMMENFASSUNG Viele dynamische Programmiersprachen sind durch klassische In- terpreter implementiert, weil das Implementieren von Just-in- Time-Compilern für sie zu komplex ist. Dies schränkt ihre Geschwindigkeit und ihre Anwendbarkeit ein. In dieser Arbeit wird Meta-Tracing beschrieben, eine Methode, die es möglich macht, einen einzigen Tracing-JIT-Compiler auf eine große Bandbreite an Sprachen anzuwenden. Der Ansatz ist flexibel genug, typische JIT- Techniken zu ermöglichen, z.B. Laufzeit-Typ-Feedback und Unbox- ing. Mit Hilfe mehrerer Fallstudien wird Meta-Tracing evaluiert, indem es auf verschiedene Sprachimplementierungen angewendet wird. Geschwindigkeitsmessungen zeigen Verbesserungen von bis zu einem Faktor 50 für Implementierungen von Produktionssprachen.
    [Show full text]