New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

petard

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

petard - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

include/utils/nan_macros.h

50

index.js
// petard, an llvm library
ffi = require('ffi');
// load the native module

@@ -21,2 +23,5 @@ var petard = require('bindings')('petard');

arrayOf: petard.getArrayTy,
vectorOf: petard.getVectorTy,
structOf: petard.getStructTy,
pointerTo: petard.getPointerTy

@@ -86,3 +91,3 @@

// structured switch statement helper
var switchimpl = function Switch(cond) {
var chooseimpl = function Choose(cond) {

@@ -121,5 +126,46 @@ var that = this;

attach("select", switchimpl);
attach("choose", chooseimpl);
// helper to load a jitted function
var origMakeFn = petard.CodeUnit.prototype.makeFunction;
petard.CodeUnit.prototype.makeFunction = function() {
var fn = origMakeFn.apply(this, arguments);
fn.codeUnit = this;
return fn;
};
function convertToRefType(ty) {
if (ty.isVoidType()) return 'void';
if (ty.isIntType()) return 'int';
if (ty.isFloatType()) return 'float';
if (ty.isArrayType() && ty.element.isIntType() && ty.element.bitwidth == 8) return 'string';
if (ty.isPointerType() && ty.pointee.isIntType() && ty.pointee.bitwidth == 8) return 'string';
if (ty.isFunctionType()) {
var ret = convertToRefType(ty.returns);
var params = ty.parameters.map(function (p) { return convertToRefType(p); });
if (!ret) return;
if (!params.every(function (p) { return !!p; })) return;
return [ret, params];
}
}
var jitimpl = function JITFunction() {
fnty = convertToRefType(this.type);
if (!fnty) return;
fn = this.codeUnit.jitFunction(this);
return ffi.ForeignFunction(fn, fnty[0], fnty[1]);
};
attach("jitCompile", jitimpl);
// export everything
module.exports = petard;

5

package.json
{
"name": "petard",
"version": "0.0.4",
"version": "0.0.5",
"description": "a js llvm library",

@@ -8,3 +8,3 @@ "main": "index.js",

"clean": "node-gyp clean",
"build": "node-gyp configure && node-gyp build",
"build": "LLVM_CONFIG=llvm-config node-gyp configure && node-gyp build",
"test": "node_modules/mocha/bin/mocha --reporter spec"

@@ -27,2 +27,3 @@ },

"bindings": "^1.2.1",
"ffi": "^2.0.0",
"nan": "^2.1.0"

@@ -29,0 +30,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc