diff --git a/.travis.yml b/.travis.yml index 03777b57..a4cf752c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,16 @@ before_install: exit } fi - - wget https://github.com/graalvm/openjdk8-jvmci-builder/releases/download/jvmci-20.1-b02/openjdk-8u252+09-jvmci-20.1-b02-linux-amd64.tar.gz - - mkdir openjdk1.8.0-jvmci - - tar --strip 1 -C openjdk1.8.0-jvmci -xvf openjdk-*.tar.gz - git clone https://github.com/graalvm/mx.git before_script: - - export JAVA_HOME=$TRAVIS_BUILD_DIR/openjdk1.8.0-jvmci - export PATH=$TRAVIS_BUILD_DIR/mx:$JAVA_HOME/bin:$PATH script: - mx sforceimports - mx sversions + - mx fetch-jdk --java-distribution openjdk8 --config ../graal/common.json --to $TRAVIS_BUILD_DIR --alias openjdk1.8.0-jvmci + - export JAVA_HOME=$TRAVIS_BUILD_DIR/openjdk1.8.0-jvmci - mx checkstyle --primary - mx checkcopyrights-nodeprof - mx build diff --git a/mx.nodeprof/suite.py b/mx.nodeprof/suite.py index 527318e4..e0e6024d 100644 --- a/mx.nodeprof/suite.py +++ b/mx.nodeprof/suite.py @@ -6,7 +6,7 @@ "suites" : [ { "name" : "graal-nodejs", - "version" : "299f61f58255b89add37b92882f1da7ffdf76fc4", + "version" : "79fd5049c416439eddc199dc473d459f328feddf", "subdir" : True, "urls" : [ {"url" : "https://github.com/graalvm/graaljs.git", "kind" : "git"}, diff --git a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/js-special.js b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/js-special.js index c8eac4c3..1f77b6ac 100644 --- a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/js-special.js +++ b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/js-special.js @@ -20,7 +20,6 @@ var internals = new Set(); var builtins = new Set(); var mute = false; - var entered = false; function NodeInternal() { const analysis = 'node-module'; @@ -28,21 +27,22 @@ if (f.name == '' || f.name == 'readPackage' || mute) return; console.log("%s: functionEnter: %s / %s / %d", analysis, f.name, J$.iidToLocation(iid).replace(/:.*[0-9]/,''), arguments.length); - entered = true; }; this.endExecution = function () { - if (!entered) - return; mute = true; console.log(internals); }; } - sandbox.addAnalysis(new NodeInternal(), function filter(source) { - if (source.internal && source.name.includes('module')) { - internals.add(source.name); - return true; - } - }); + + // run NodeInternal analysis only with one test + if (process.argv[process.argv.length - 1].endsWith('donotinstrument.js')) { + sandbox.addAnalysis(new NodeInternal(), function filter(source) { + if (source.internal && source.name.includes('module')) { + internals.add(source.name); + return true; + } + }); + } function BI() { const analysis = 'builtin'; @@ -52,8 +52,6 @@ } } this.endExecution = function () { - if (!entered) - return; mute = true; console.log([...builtins].filter(x => x.includes('create'))); }; diff --git a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.donotinstrument.js.expected b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.donotinstrument.js.expected index cd0f29c7..90b5987e 100644 --- a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.donotinstrument.js.expected +++ b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.donotinstrument.js.expected @@ -1,20 +1,40 @@ +node-module: functionEnter: get / (*internal/modules/esm/module_map.js) / 4 +node-module: functionEnter: set / (*internal/modules/esm/module_map.js) / 4 node-module: functionEnter: require / (*internal/modules/cjs/helpers.js) / 4 node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: resolveExports / (*internal/modules/cjs/loader.js) / 4 +node-module: functionEnter: executeUserEntryPoint / (*internal/modules/run_main.js) / 4 +node-module: functionEnter: resolveMainPath / (*internal/modules/run_main.js) / 4 node-module: functionEnter: stat / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: toRealPath / (*internal/modules/cjs/loader.js) / 4 +node-module: functionEnter: toRealPath / (*internal/modules/cjs/loader.js) / 4 +node-module: functionEnter: shouldUseESMLoader / (*internal/modules/run_main.js) / 4 +node-module: functionEnter: readPackageScope / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 node-module: functionEnter: Module / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: updateChildren / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: findLongestRegisteredExtension / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: readPackageScope / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stripBOM / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: stripShebang / (*internal/modules/cjs/helpers.js) / 4 +node-module: functionEnter: wrapSafe / (*internal/modules/cjs/loader.js) / 4 node-module: functionEnter: makeRequireFunction / (*internal/modules/cjs/helpers.js) / 4 +node-module: functionEnter: get / (*internal/modules/esm/module_map.js) / 4 +node-module: functionEnter: set / (*internal/modules/esm/module_map.js) / 4 +node-module: functionEnter: get / (*internal/modules/esm/module_map.js) / 4 +node-module: functionEnter: set / (*internal/modules/esm/module_map.js) / 4 Set { 'internal/main/run_main_module.js', 'internal/modules/cjs/loader.js', 'internal/modules/cjs/helpers.js', + 'internal/modules/esm/loader.js', + 'internal/modules/esm/module_map.js', + 'internal/modules/esm/module_job.js', + 'internal/modules/esm/resolve.js', + 'internal/modules/esm/get_format.js', + 'internal/modules/esm/get_source.js', + 'internal/modules/esm/transform_source.js', + 'internal/modules/esm/create_dynamic_module.js', + 'internal/modules/esm/translators.js', + 'internal/vm/module.js', + 'internal/modules/run_main.js', 'module.js' } [ 'Object.create' ] diff --git a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.require.js.expected b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.require.js.expected index 52c33cb7..616bebd8 100644 --- a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.require.js.expected +++ b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.require.js.expected @@ -1,38 +1,6 @@ -node-module: functionEnter: require / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: resolveExports / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stat / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: toRealPath / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: Module / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: updateChildren / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: findLongestRegisteredExtension / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: readPackageScope / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stripBOM / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: stripShebang / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: makeRequireFunction / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: require / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: stat / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: resolveExports / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stat / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: toRealPath / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: Module / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: updateChildren / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: findLongestRegisteredExtension / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: readPackageScope / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stripBOM / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: stripShebang / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: makeRequireFunction / (*internal/modules/cjs/helpers.js) / 4 analysis 1: functionEnter: foo / (src/ch.usi.inf.nodeprof.test/js/minitests/enterExit.js:16:2:18:2) / 4 analysis 2: functionEnter: foo / (src/ch.usi.inf.nodeprof.test/js/minitests/enterExit.js:16:2:18:2) / 4 analysis 1: getField: create / (src/ch.usi.inf.nodeprof.test/js/minitests/enterExit.js:17:11:17:24) / 7 getField (src/ch.usi.inf.nodeprof.test/js/minitests/enterExit.js:17:11:17:24) in exclusion.js release name: node -Set { - 'internal/main/run_main_module.js', - 'internal/modules/cjs/loader.js', - 'internal/modules/cjs/helpers.js', - 'module.js' -} [ 'Object.create' ] diff --git a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.testFilter.js.expected b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.testFilter.js.expected index c6785def..4fc0bf9d 100644 --- a/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.testFilter.js.expected +++ b/src/ch.usi.inf.nodeprof/js/analysis/customized-filters/minitests.testFilter.js.expected @@ -1,21 +1,2 @@ -node-module: functionEnter: require / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: resolveExports / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stat / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: toRealPath / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: loadNativeModule / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: Module / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: updateChildren / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: findLongestRegisteredExtension / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: readPackageScope / (*internal/modules/cjs/loader.js) / 4 -node-module: functionEnter: stripBOM / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: stripShebang / (*internal/modules/cjs/helpers.js) / 4 -node-module: functionEnter: makeRequireFunction / (*internal/modules/cjs/helpers.js) / 4 getField (src/ch.usi.inf.nodeprof.test/js/minitests/testFilter.js:19:7:19:10) in inclusion.js -Set { - 'internal/main/run_main_module.js', - 'internal/modules/cjs/loader.js', - 'internal/modules/cjs/helpers.js', - 'module.js' -} [ 'Object.create' ] diff --git a/src/ch.usi.inf.nodeprof/src/ch/usi/inf/nodeprof/jalangi/NodeProfJalangi.java b/src/ch.usi.inf.nodeprof/src/ch/usi/inf/nodeprof/jalangi/NodeProfJalangi.java index 0a14015e..4513d706 100644 --- a/src/ch.usi.inf.nodeprof/src/ch/usi/inf/nodeprof/jalangi/NodeProfJalangi.java +++ b/src/ch.usi.inf.nodeprof/src/ch/usi/inf/nodeprof/jalangi/NodeProfJalangi.java @@ -62,7 +62,7 @@ public NodeProfJalangi(Instrumenter instrumenter, Env env) { public Object onLoad() throws Exception { // Get the global object via an indirect eval that works in strict mode. // Define __jalangiAdapter on it, then implicitly "return" it to set the JS context. - Source src = Source.newBuilder(JavaScriptLanguage.ID, "(1,eval)('this').__jalangiAdapter = adapterVar; return (1,eval)('this')", "nodeprof").build(); + Source src = Source.newBuilder(JavaScriptLanguage.ID, "(1,eval)('this').__jalangiAdapter = adapterVar; (1,eval)('this')", "nodeprof").build(); CallTarget bootstrap = this.getEnv().parse(src, "adapterVar"); Object globalObject = bootstrap.call(new JalangiAdapter(this)); assert JSTypes.isDynamicObject(globalObject) : "bootstrap call did not return object";