// See: http://duktape.org/api.html#duk_push_pointer
199902
func (d *Context) PushPointer(p unsafe.Pointer) {
	C.duk_push_pointer(d.duk_context, p)
}
790334
func (slist *syncedList) PushFront(v interface{}) *list.Element {
	slist.Lock()
	defer slist.Unlock()

	return slist.queue.PushFront(v)
}
39891
func (l *list) PushFront(v interface{}) *element {
	return l.insertValue(v, &l.root)
}
705873
func (i *IndexedGCAllocPQ) Push(allocID string, ar AllocRunner) bool {
	i.pqLock.Lock()
	defer i.pqLock.Unlock()

	if _, ok := i.index[allocID]; ok {
		// No work to do
		return false
	}
	gcAlloc := &GCAlloc{
		timeStamp:   time.Now(),
		allocID:     allocID,
		allocRunner: ar,
	}
	i.index[allocID] = gcAlloc
	heap.Push(&i.heap, gcAlloc)
	return true
}
20535
func (l *PacketList) PushBack(v Packet) *PacketElement {
	l.lazyInit()
	return l.insertValue(v, l.root.prev)
}
529478
func (l *list) PushBack(v interface{}) *element {
	return l.insertValue(v, l.root.prev)
}
672427
func (s *SliceStack) Push(item interface{}) {
	s.size++
	s.backing = append(s.backing, item)
}
1247436
func (dc *Context) Push() {
	x := *dc
	dc.stack = append(dc.stack, &x)
}
794615
func (l *List) PushBack(v string) *Element {
	l.lazyInit()
	return l.insertValue(v, l.root.prev)
}
1353574
func PushLastF(Len int, Less func(i, j int) bool, Swap func(i, j int)) {
	heapUp(Less, Swap, Len-1)
}
419468
func (d *Context) GetPointer(index int) unsafe.Pointer {
	return C.duk_get_pointer(d.duk_context, C.duk_idx_t(index))
}
315327
func (p *parser) pushV() {
	if cap(p.vstack) == len(p.vstack) {
		// create new empty slot in the stack
		p.vstack = append(p.vstack, nil)
	} else {
		// slice to 1 more
		p.vstack = p.vstack[:len(p.vstack)+1]
	}

	// get the last args set
	m := p.vstack[len(p.vstack)-1]
	if m != nil && len(m) == 0 {
		// empty map, all good
		return
	}

	m = make(map[string]interface{})
	p.vstack[len(p.vstack)-1] = m
}
555905
func (d *Context) IsPointer(index int) bool {
	return int(C.duk_is_pointer(d.duk_context, C.duk_idx_t(index))) == 1
}
864398
func (dw *dbWrapper) pushObject(vm *duktape.Context) {
	obj := vm.PushObject()

	// Push the wrapper for statedb.GetBalance
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		pushBigInt(dw.db.GetBalance(common.BytesToAddress(popSlice(ctx))), ctx)
		return 1
	})
	vm.PutPropString(obj, "getBalance")

	// Push the wrapper for statedb.GetNonce
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		ctx.PushInt(int(dw.db.GetNonce(common.BytesToAddress(popSlice(ctx)))))
		return 1
	})
	vm.PutPropString(obj, "getNonce")

	// Push the wrapper for statedb.GetCode
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		code := dw.db.GetCode(common.BytesToAddress(popSlice(ctx)))

		ptr := ctx.PushFixedBuffer(len(code))
		copy(makeSlice(ptr, uint(len(code))), code)
		return 1
	})
	vm.PutPropString(obj, "getCode")

	// Push the wrapper for statedb.GetState
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		hash := popSlice(ctx)
		addr := popSlice(ctx)

		state := dw.db.GetState(common.BytesToAddress(addr), common.BytesToHash(hash))

		ptr := ctx.PushFixedBuffer(len(state))
		copy(makeSlice(ptr, uint(len(state))), state[:])
		return 1
	})
	vm.PutPropString(obj, "getState")

	// Push the wrapper for statedb.Exists
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		ctx.PushBoolean(dw.db.Exist(common.BytesToAddress(popSlice(ctx))))
		return 1
	})
	vm.PutPropString(obj, "exists")
}
1288719
func (d *Context) PushBufferObject(bufferIdx, size, length int, flags uint) {
	C.duk_push_buffer_object(
		d.duk_context,
		C.duk_idx_t(bufferIdx),
		C.duk_size_t(size),
		C.duk_size_t(length),
		C.duk_uint_t(flags),
	)
}
995043
func (mw *memoryWrapper) pushObject(vm *duktape.Context) {
	obj := vm.PushObject()

	// Generate the `slice` method which takes two ints and returns a buffer
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		blob := mw.slice(int64(ctx.GetInt(-2)), int64(ctx.GetInt(-1)))
		ctx.Pop2()

		ptr := ctx.PushFixedBuffer(len(blob))
		copy(makeSlice(ptr, uint(len(blob))), blob)
		return 1
	})
	vm.PutPropString(obj, "slice")

	// Generate the `getUint` method which takes an int and returns a bigint
	vm.PushGoFunction(func(ctx *duktape.Context) int {
		offset := int64(ctx.GetInt(-1))
		ctx.Pop()

		pushBigInt(mw.getUint(offset), ctx)
		return 1
	})
	vm.PutPropString(obj, "getUint")
}
1200125
func (s *scopeStack) push() {
	s.scopes = append(s.scopes, make(map[string]Value))
}