The bond-market’s math is starting to look a little scary for the riskiest corporate borrowers.

With the Federal Reserve set to raise interest rates for the first time in nearly a decade, a measure of the cost to refinance junk debt has surged to the highest since 2009, according to Bank of America Merrill Lynch data. Investors are demanding more than 18 percent on average to own the debt of companies rated CCC+ or lower, the riskiest in the high-yield category. That compares with 8.3 percent that the companies are currently paying on the debt they’ve been racking up in an era of cheap credit.

For borrowers that have benefited from seven years of cheap money, that’s pointing to one thing: Time may be up. And, increasingly, companies are going to have to ask their creditors to restructure debt to avoid bankruptcy, according to Wells Capital Management.

“The door has closed,” said Margie Patel, a money manager for Wells Capital Management in Boston, which manages $351 billion. “The events of the last week are putting real pressure on the bottom-tier companies, and the ability to finesse your balance sheet through issuing more bonds is pretty much at zero. They won’t be able to extend any longer."

Already reeling from the deleterious effect the lowest oil prices in six years are having on high-yield energy debt, investors are growing more nervous after Third Avenue Management took the rare step of freezing withdrawals from a $788 million credit mutual fund.

Losses of 15 percent in the riskiest part of the market this year are on pace for the worst performance since 2008 and the third worst year on record, according to Bank of America Merrill Lynch Indexes. Yields on the securities -- those rated CCC+ or lower -- have surged to more than 18 percent from a record-low 8.7 percent in June 2014.

The market’s new assessment of junk debt will weigh on companies for years, said Matthew Mish, a credit strategist at UBS Group AG. Appetite for risk globally is souring as the countdown to the Fed’s probable interest-rate increase on Wednesday sparked a selloff in equities and other risk assets.

"The market was lulled into a false sense of complacency by the Fed," said Mish. "The whole idea of a highly levered issuer generating positive cash flow starts to unwind as funding costs go up. A lot of these companies work until they don’t."

Exacerbating the selloff is the fear that there will be fewer buyers willing to step in to stem losses if the selling pressure rises.

That concern may be overblown, according to some investors.