Skip to content

Commit

Permalink
Merge pull request #76 from Haiyang-Sun/update-env-parse
Browse files Browse the repository at this point in the history
Updates to latest Graal.js with changed Env.parse() behavior
  • Loading branch information
Haiyang-Sun authored Jul 14, 2020
2 parents 08628be + 9aceb52 commit 45e19b5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 72 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mx.nodeprof/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"suites" : [
{
"name" : "graal-nodejs",
"version" : "299f61f58255b89add37b92882f1da7ffdf76fc4",
"version" : "79fd5049c416439eddc199dc473d459f328feddf",
"subdir" : True,
"urls" : [
{"url" : "https://github.com/graalvm/graaljs.git", "kind" : "git"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
var internals = new Set();
var builtins = new Set();
var mute = false;
var entered = false;

function NodeInternal() {
const analysis = 'node-module';
this.functionEnter = function (iid, f, dis, args) {
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';
Expand All @@ -52,8 +52,6 @@
}
}
this.endExecution = function () {
if (!entered)
return;
mute = true;
console.log([...builtins].filter(x => x.includes('create')));
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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' ]
Original file line number Diff line number Diff line change
@@ -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' ]
Original file line number Diff line number Diff line change
@@ -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' ]
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 45e19b5

Please sign in to comment.