Generating Virtual Machine Code of JavaScript Engine for Embedded Systems

Virtual machines (VMs) for dynamically managed languages such as JavaScript are generally implemented in C or C++. Implementation of VMs in such low-level languages offers the advantage of high flexibility, but it suffers from problems of descriptiveness and safety. These problems are due to the fac...

Full description

Saved in:
Bibliographic Details
Published inJournal of Information Processing Vol. 30; pp. 679 - 693
Main Authors Hirasawa, Yuta, Iwasaki, Hideya, Ugawa, Tomoharu, Onozawa, Hiro
Format Journal Article
LanguageEnglish
Published Information Processing Society of Japan 2022
Subjects
Online AccessGet full text

Cover

Loading…
Abstract Virtual machines (VMs) for dynamically managed languages such as JavaScript are generally implemented in C or C++. Implementation of VMs in such low-level languages offers the advantage of high flexibility, but it suffers from problems of descriptiveness and safety. These problems are due to the fact that even though a variety of VM operations are based on the VM's internal datatypes for first-class objects in the target language, the C code typically treats all VM internal datatypes as a single type in C. In addition, VMs implemented in C or C++ have a size problem which is a serious issue for VMs on embedded systems. The reason for this problem is the difficulty of eliminating unnecessary code fragments from the C code for a specific application. To solve these problems, we propose a domain-specific language for describing VM programs and a corresponding compiler to C programs, called VMDL and VMDLC, respectively. We also propose related utility tools. This framework enables generation of C source code for an eJSVM, a JavaScript VM for embedded systems. VMDL's concise syntax enables static VM datatype analysis for optimizations and error detection. We evaluated the framework and confirmed its effectiveness from both qualitative and quantitative viewpoints.
AbstractList Virtual machines (VMs) for dynamically managed languages such as JavaScript are generally implemented in C or C++. Implementation of VMs in such low-level languages offers the advantage of high flexibility, but it suffers from problems of descriptiveness and safety. These problems are due to the fact that even though a variety of VM operations are based on the VM's internal datatypes for first-class objects in the target language, the C code typically treats all VM internal datatypes as a single type in C. In addition, VMs implemented in C or C++ have a size problem which is a serious issue for VMs on embedded systems. The reason for this problem is the difficulty of eliminating unnecessary code fragments from the C code for a specific application. To solve these problems, we propose a domain-specific language for describing VM programs and a corresponding compiler to C programs, called VMDL and VMDLC, respectively. We also propose related utility tools. This framework enables generation of C source code for an eJSVM, a JavaScript VM for embedded systems. VMDL's concise syntax enables static VM datatype analysis for optimizations and error detection. We evaluated the framework and confirmed its effectiveness from both qualitative and quantitative viewpoints.
Author Iwasaki, Hideya
Hirasawa, Yuta
Onozawa, Hiro
Ugawa, Tomoharu
Author_xml – sequence: 1
  fullname: Hirasawa, Yuta
  organization: The University of Electro-Communications
– sequence: 2
  fullname: Iwasaki, Hideya
  organization: The University of Electro-Communications
– sequence: 3
  fullname: Ugawa, Tomoharu
  organization: The University of Tokyo
– sequence: 4
  fullname: Onozawa, Hiro
  organization: The University of Electro-Communications
BookMark eNpNkEtPAjEUhRuDiYBuXfcPzNgHnZkuCUHEYFygbps7fUAn0Jm0own_XgiEsLonOee7i2-EBqENFqFnSnJGZfniu9Q0vss5yYtS3qEhrSqWFYVgg5v8gEYpNYQUkggyRMuFDTZC78MG__jY_8IOf4De-mDxrDUWtw6_wx-sdfRdj-dhc2pcG_F8X1tjrMHrQ-rtPj2iewe7ZJ8ud4y-X-dfs7ds9blYzqarTLOSy4wBLQifVFDKigldcMZ1VQlDDUy00NxJbmtWOCdAS81qIYjjwsi6okCpkHyM8vNfHduUonWqi34P8aAoUScR6iJCcaKOIo7A9Aw0qYeNvc4h9l7v7O2cXJhrp7cQlQ38H4RxbE8
Cites_doi 10.1145/3062341.3062381
10.1145/2400682.2400689
10.1007/3-540-48228-8_70
10.1007/978-3-642-03237-0_17
10.1145/2509578.2509581
10.1145/800017.800542
10.1145/96709.96722
10.1145/2658761.2658776
10.1145/2989225.2989232
10.1007/978-3-540-25935-0_12
10.1016/j.cola.2019.01.003
10.1145/1328897.1328486
10.1147/sj.442.0399
10.1145/74878.74884
10.1145/53990.54007
10.1007/978-3-540-31985-6_18
10.1002/spe.434
10.1145/362248.362270
10.1145/3386327
10.1145/3459898.3463903
ContentType Journal Article
Copyright 2022 by the Information Processing Society of Japan
Copyright_xml – notice: 2022 by the Information Processing Society of Japan
DBID AAYXX
CITATION
DOI 10.2197/ipsjjip.30.679
DatabaseName CrossRef
DatabaseTitle CrossRef
DatabaseTitleList
DeliveryMethod fulltext_linktorsrc
Discipline Computer Science
EISSN 1882-6652
EndPage 693
ExternalDocumentID 10_2197_ipsjjip_30_679
article_ipsjjip_30_0_30_679_article_char_en
GroupedDBID 2WC
ALMA_UNASSIGNED_HOLDINGS
CS3
JSF
JSH
KQ8
RJT
RZJ
TKC
AAYXX
CITATION
ID FETCH-LOGICAL-c2739-2a160348a79825c6323c885d1da4c5c3f93eb26ff5ac9c2b550f35d9b81a11593
ISSN 1882-6652
IngestDate Tue Jul 01 01:44:56 EDT 2025
Wed Apr 05 11:38:17 EDT 2023
IsDoiOpenAccess true
IsOpenAccess true
IsPeerReviewed false
IsScholarly false
Language English
LinkModel OpenURL
MergedId FETCHMERGED-LOGICAL-c2739-2a160348a79825c6323c885d1da4c5c3f93eb26ff5ac9c2b550f35d9b81a11593
OpenAccessLink https://www.jstage.jst.go.jp/article/ipsjjip/30/0/30_679/_article/-char/en
PageCount 15
ParticipantIDs crossref_primary_10_2197_ipsjjip_30_679
jstage_primary_article_ipsjjip_30_0_30_679_article_char_en
ProviderPackageCode CITATION
AAYXX
PublicationCentury 2000
PublicationDate 2022
2022-00-00
PublicationDateYYYYMMDD 2022-01-01
PublicationDate_xml – year: 2022
  text: 2022
PublicationDecade 2020
PublicationTitle Journal of Information Processing
PublicationTitleAlternate Journal of Information Processing
PublicationYear 2022
Publisher Information Processing Society of Japan
Publisher_xml – name: Information Processing Society of Japan
References [17] Onozawa, H., Iwasaki, H. and Ugawa, T.: Customizing JavaScript Virtual Machines for Specific Applications and Execution Environments (in Japanese), Computer Software, Vol.38, No.3, pp.23-40 (2021).
[9] Graver, J.O. and Johnson, R.E.: A Type System for Smalltalk, Conference Record of 17th Annual ACM Symposium on Principles of Programming Languages (POPL 1990), pp.136-150, ACM (1990).
[21] Ugawa, T., Iwasaki, H. and Kataoka, T.: eJSTK: Building JavaScript virtual machines with customized datatypes for embedded systems, J. Comput. Lang., Vol.51, pp.261-279 (2019).
[12] Humer, C., Wimmer, C., Wirth, C., Wöß, A. and Würthinger, T.: A domain-specific language for building self-optimizing AST interpreters, Proc. 2014 International Conference on Generative Programming: Concepts and Experiences (GPCE 2014), pp.123-132, ACM (2014).
[15] Marr, S., Daloze, B. and Mössenböck, H.: Cross-Language Compiler Benchmarking—Are We Fast Yet?, Proc. 12th Symposium on Dynamic Languages (DLS 2016), pp.120-131, ACM (2016).
[25] Würthinger, T., Wimmer, C., Wöß, A., Stadler, L., Duboscq, G., Humer, C., Richards, G., Simon, D. and Wolczko, M.: One VM to rule them all, Proc. ACM Symposium on New Ideas in Programming and Reflections on Software (Onward! 2013), pp.187-204, ACM (2013).
[19] Shivers, O.: Control-Flow Analysis in Scheme, Proc. ACM SIGPLAN'88 Conference on Programming Language Design and Implementation (PLDI 1988), pp.164-174, ACM (1988).
[23] Wirfs-Brock, A. and Eich, B.: JavaScript: The first 20 years, Proc. ACM Program. Lang., Vol.4, No.HOPL, pp.77:1-77:189 (2020).
[24] Würthinger, T., Wimmer, C., Humer, C., Wöß, A., Stadler, L., Seaton, C., Duboscq, G., Simon, D. and Grimmer, M.: Practical partial evaluation for high-performance dynamic language runtimes, Proc. 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017), pp.662-676, ACM (2017).
[8] Ertl, M.A., Gregg, D., Krall, A. and Paysan, B.: Vmgen: A generator of efficient virtual machine interpreters, Softw., Pract. Exper., Vol.32, No.3, pp.265-294 (2002).
[16] Monat, R., Ouadjaout, A. and Miné, A.: Static Type Analysis by Abstract Interpretation of Python Programs, 34th European Conference on Object-Oriented Programming (ECOOP 2020), LIPIcs, Vol.166, Schloss Dagstuhl - Leibniz-Zentrum für Informatik, pp.17:1-17:29 (2020).
[2] Bell, J.R.: Threaded Code, Comm. ACM, Vol.16, No.6, pp.370-372 (1973).
[6] ECMA International: Standard ECMA-262 - ECMAScript 2021 Language Specification (2021).
[1] Alpern, B., Augart, S., Blackburn, S.M., Butrico, M.A., Cocchi, A., Cheng, P., Dolby, J., Fink, S.J., Grove, D., Hind, M., McKinley, K.S., Mergen, M.F., Moss, J.E.B., Ngo, T.A., Sarkar, V. and Trapp, M.: The Jikes Research Virtual Machine project: Building an open-source research community, IBM Syst. J., Vol.44, No.2, pp.399-418 (2005).
[18] Onozawa, H., Ugawa, T. and Iwasaki, H.: Fusuma: Double-ended threaded compaction, Proc. 2021 ACM SIGPLAN International Symposium on Memory Management (ISMM 2021), pp.94-106, ACM (2021).
[22] Wimmer, C., Haupt, M., de Vanter, M.L.V., Jordan, M.J., Daynès, L. and Simon, D.: Maxine: An approachable virtual machine for, and in, java, ACM Trans. Archit. Code Optim., Vol.9, No.4, pp.30:1-30:24 (2013).
[7] Ertl, M.A.: A Portable Forth Engine, Proc. EuroFORTH '93 Conference (1993).
[10] Gregg, D. and Ertl, M.A.: A Language and Tool for Generating Efficient Virtual Machine Interpreters, Proc. Domain-Specific Program Generation, pp.196-215 (2003).
[11] Gregg, D., Ertl, M.A. and Krall, A.: Implementing an Efficient Java Interpreter, Proc. High-Performance Computing and Networking, 9th International Conference, HPCN Europe 2001, pp.613-620 (2001).
[20] Tobin-Hochstadt, S. and Felleisen, M.: The design and implementation of typed scheme, Proc. 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), pp.395-406, ACM (2008).
[14] Latendresse, M.: Automatic Generation of Compact Programs and Virtual Machines for Scheme, Proc. Workshop on Scheme and Functional Programming (2000) (online), available from <http://www.ai.sri.com/latendre/pli.pdf>.
[5] Deutsch, L.P. and Schiffman, A.M.: Efficient Implementation of the Smalltalk-80 System, Proc. 11th Annual ACM Symposium on Principles of Programming Languages (POPL 1984), pp.297-302, ACM (1984).
[3] Casey, K., Gregg, D. and Ertl, M.A.: Tiger - An Interpreter Generation Tool, Proc. Compiler Construction, 14th International Conference (CC 2005), Lecture Notes in Computer Science, Vol.3443, pp.246-249, Springer (2005).
[4] Chambers, C., Ungar, D.M. and Lee, E.: An Efficient Implementation of SELF a Dynamically-Typed Object-Oriented Language Based on Prototypes, Proc. Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA 1989), pp.49-70, ACM (1989).
[13] Jensen, S.H., Møller, A. and Thiemann, P.: Type Analysis for JavaScript, Proc. Static Analysis, 16th International Symposium (SAS 2009), Lecture Notes in Computer Science, Vol.5673, pp.238-255, Springer (2009).
22
23
24
25
10
11
12
13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
20
21
References_xml – reference: [16] Monat, R., Ouadjaout, A. and Miné, A.: Static Type Analysis by Abstract Interpretation of Python Programs, 34th European Conference on Object-Oriented Programming (ECOOP 2020), LIPIcs, Vol.166, Schloss Dagstuhl - Leibniz-Zentrum für Informatik, pp.17:1-17:29 (2020).
– reference: [20] Tobin-Hochstadt, S. and Felleisen, M.: The design and implementation of typed scheme, Proc. 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), pp.395-406, ACM (2008).
– reference: [8] Ertl, M.A., Gregg, D., Krall, A. and Paysan, B.: Vmgen: A generator of efficient virtual machine interpreters, Softw., Pract. Exper., Vol.32, No.3, pp.265-294 (2002).
– reference: [12] Humer, C., Wimmer, C., Wirth, C., Wöß, A. and Würthinger, T.: A domain-specific language for building self-optimizing AST interpreters, Proc. 2014 International Conference on Generative Programming: Concepts and Experiences (GPCE 2014), pp.123-132, ACM (2014).
– reference: [17] Onozawa, H., Iwasaki, H. and Ugawa, T.: Customizing JavaScript Virtual Machines for Specific Applications and Execution Environments (in Japanese), Computer Software, Vol.38, No.3, pp.23-40 (2021).
– reference: [9] Graver, J.O. and Johnson, R.E.: A Type System for Smalltalk, Conference Record of 17th Annual ACM Symposium on Principles of Programming Languages (POPL 1990), pp.136-150, ACM (1990).
– reference: [25] Würthinger, T., Wimmer, C., Wöß, A., Stadler, L., Duboscq, G., Humer, C., Richards, G., Simon, D. and Wolczko, M.: One VM to rule them all, Proc. ACM Symposium on New Ideas in Programming and Reflections on Software (Onward! 2013), pp.187-204, ACM (2013).
– reference: [13] Jensen, S.H., Møller, A. and Thiemann, P.: Type Analysis for JavaScript, Proc. Static Analysis, 16th International Symposium (SAS 2009), Lecture Notes in Computer Science, Vol.5673, pp.238-255, Springer (2009).
– reference: [4] Chambers, C., Ungar, D.M. and Lee, E.: An Efficient Implementation of SELF a Dynamically-Typed Object-Oriented Language Based on Prototypes, Proc. Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA 1989), pp.49-70, ACM (1989).
– reference: [7] Ertl, M.A.: A Portable Forth Engine, Proc. EuroFORTH '93 Conference (1993).
– reference: [21] Ugawa, T., Iwasaki, H. and Kataoka, T.: eJSTK: Building JavaScript virtual machines with customized datatypes for embedded systems, J. Comput. Lang., Vol.51, pp.261-279 (2019).
– reference: [2] Bell, J.R.: Threaded Code, Comm. ACM, Vol.16, No.6, pp.370-372 (1973).
– reference: [14] Latendresse, M.: Automatic Generation of Compact Programs and Virtual Machines for Scheme, Proc. Workshop on Scheme and Functional Programming (2000) (online), available from <http://www.ai.sri.com/latendre/pli.pdf>.
– reference: [6] ECMA International: Standard ECMA-262 - ECMAScript 2021 Language Specification (2021).
– reference: [11] Gregg, D., Ertl, M.A. and Krall, A.: Implementing an Efficient Java Interpreter, Proc. High-Performance Computing and Networking, 9th International Conference, HPCN Europe 2001, pp.613-620 (2001).
– reference: [10] Gregg, D. and Ertl, M.A.: A Language and Tool for Generating Efficient Virtual Machine Interpreters, Proc. Domain-Specific Program Generation, pp.196-215 (2003).
– reference: [19] Shivers, O.: Control-Flow Analysis in Scheme, Proc. ACM SIGPLAN'88 Conference on Programming Language Design and Implementation (PLDI 1988), pp.164-174, ACM (1988).
– reference: [22] Wimmer, C., Haupt, M., de Vanter, M.L.V., Jordan, M.J., Daynès, L. and Simon, D.: Maxine: An approachable virtual machine for, and in, java, ACM Trans. Archit. Code Optim., Vol.9, No.4, pp.30:1-30:24 (2013).
– reference: [18] Onozawa, H., Ugawa, T. and Iwasaki, H.: Fusuma: Double-ended threaded compaction, Proc. 2021 ACM SIGPLAN International Symposium on Memory Management (ISMM 2021), pp.94-106, ACM (2021).
– reference: [1] Alpern, B., Augart, S., Blackburn, S.M., Butrico, M.A., Cocchi, A., Cheng, P., Dolby, J., Fink, S.J., Grove, D., Hind, M., McKinley, K.S., Mergen, M.F., Moss, J.E.B., Ngo, T.A., Sarkar, V. and Trapp, M.: The Jikes Research Virtual Machine project: Building an open-source research community, IBM Syst. J., Vol.44, No.2, pp.399-418 (2005).
– reference: [3] Casey, K., Gregg, D. and Ertl, M.A.: Tiger - An Interpreter Generation Tool, Proc. Compiler Construction, 14th International Conference (CC 2005), Lecture Notes in Computer Science, Vol.3443, pp.246-249, Springer (2005).
– reference: [5] Deutsch, L.P. and Schiffman, A.M.: Efficient Implementation of the Smalltalk-80 System, Proc. 11th Annual ACM Symposium on Principles of Programming Languages (POPL 1984), pp.297-302, ACM (1984).
– reference: [23] Wirfs-Brock, A. and Eich, B.: JavaScript: The first 20 years, Proc. ACM Program. Lang., Vol.4, No.HOPL, pp.77:1-77:189 (2020).
– reference: [15] Marr, S., Daloze, B. and Mössenböck, H.: Cross-Language Compiler Benchmarking—Are We Fast Yet?, Proc. 12th Symposium on Dynamic Languages (DLS 2016), pp.120-131, ACM (2016).
– reference: [24] Würthinger, T., Wimmer, C., Humer, C., Wöß, A., Stadler, L., Seaton, C., Duboscq, G., Simon, D. and Grimmer, M.: Practical partial evaluation for high-performance dynamic language runtimes, Proc. 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017), pp.662-676, ACM (2017).
– ident: 24
  doi: 10.1145/3062341.3062381
– ident: 22
  doi: 10.1145/2400682.2400689
– ident: 16
– ident: 11
  doi: 10.1007/3-540-48228-8_70
– ident: 13
  doi: 10.1007/978-3-642-03237-0_17
– ident: 14
– ident: 25
  doi: 10.1145/2509578.2509581
– ident: 5
  doi: 10.1145/800017.800542
– ident: 9
  doi: 10.1145/96709.96722
– ident: 12
  doi: 10.1145/2658761.2658776
– ident: 7
– ident: 15
  doi: 10.1145/2989225.2989232
– ident: 10
  doi: 10.1007/978-3-540-25935-0_12
– ident: 17
– ident: 21
  doi: 10.1016/j.cola.2019.01.003
– ident: 20
  doi: 10.1145/1328897.1328486
– ident: 1
  doi: 10.1147/sj.442.0399
– ident: 4
  doi: 10.1145/74878.74884
– ident: 19
  doi: 10.1145/53990.54007
– ident: 3
  doi: 10.1007/978-3-540-31985-6_18
– ident: 8
  doi: 10.1002/spe.434
– ident: 2
  doi: 10.1145/362248.362270
– ident: 23
  doi: 10.1145/3386327
– ident: 6
– ident: 18
  doi: 10.1145/3459898.3463903
SSID ssj0069050
Score 1.812911
Snippet Virtual machines (VMs) for dynamically managed languages such as JavaScript are generally implemented in C or C++. Implementation of VMs in such low-level...
SourceID crossref
jstage
SourceType Index Database
Publisher
StartPage 679
SubjectTerms compilers
domain-specific languages
JavaScript virtual machine
VM internal datatype
Title Generating Virtual Machine Code of JavaScript Engine for Embedded Systems
URI https://www.jstage.jst.go.jp/article/ipsjjip/30/0/30_679/_article/-char/en
Volume 30
hasFullText 1
inHoldings 1
isFullTextHit
isPrint
ispartofPNX Journal of Information Processing, 2022, Vol.30, pp.679-693
link http://utb.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwnV3NT9swFLc62GGXjbFNsMHkwyRO6dI4cePdEAIVJiZNayd2qhw7hnSiqUo7RP_6PduvJmU9MC5R5Y8kyvv15-fn90HIp0RwE8uujqSQeZSqjookrPtRZoxiMi5S6eyQ5994b5CeXWQXrdaiGV0yK9pqsTau5ClShTaQq42S_Q_JhptCA_wG-cIVJAzXR8nY54x2jss_q6mLBDl3zpG2Fp121oAz-Uf-cMyAqQedX-HxdVEC4-iVhOX_qqiYVdVBZOIjCtCy0K9_39UNK0Kvmsobees00V_zWeD601toxsrYlS7vQsfgEkf36-v6Sk7nwdo7rhfYBTetm1aJpGGi7FidnXOfl7ZdrmlD3sXzGE-c3JeUwTWY-6qJD-kd2NUeMFeTm9GomrRZ3A7Tmnm0H6xvwesQ9jv2DkOcP2TWq008I5sJbDFs9Yuv38MJFBexq-4b3twn_LTzP68-f0WheT4CnX7pD-hUlP4WeYmCo4ceKK9Jqxxvk1fLuh0UafwNOb3HDUXcUMQNtbihtaH3uKEeNxSgQJe4oYibt2Rwctw_6kVYUiNSoKeKKJG2rHiay67Ik0xxljCV55nuaJmqTDEjWFkk3JhMKqGSAvavhmVaFHlHwt5BsHdkY1yPyx1CmTYwCzg9Z7mrUy902e0KrphN8afULjlYfpfhxGdOGa6XwC754j9bGIf_qOa4GAeHPhuVCCTw_tGP-UBeWKR6-9ke2ZhN5-U-aJSz4qMT_V-zRHwf
linkProvider Colorado Alliance of Research Libraries
openUrl ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.atitle=Generating+Virtual+Machine+Code+of+JavaScript+Engine+for+Embedded+Systems&rft.jtitle=Journal+of+information+processing+%28Tokyo%29&rft.au=Hirasawa%2C+Yuta&rft.au=Iwasaki%2C+Hideya&rft.au=Ugawa%2C+Tomoharu&rft.au=Onozawa%2C+Hiro&rft.date=2022&rft.issn=1882-6652&rft.eissn=1882-6652&rft.volume=30&rft.spage=679&rft.epage=693&rft_id=info:doi/10.2197%2Fipsjjip.30.679&rft.externalDBID=n%2Fa&rft.externalDocID=10_2197_ipsjjip_30_679
thumbnail_l http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/lc.gif&issn=1882-6652&client=summon
thumbnail_m http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/mc.gif&issn=1882-6652&client=summon
thumbnail_s http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/sc.gif&issn=1882-6652&client=summon